本文整理汇总了C#中System.Reflection.AssemblyName.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# AssemblyName.Equals方法的具体用法?C# AssemblyName.Equals怎么用?C# AssemblyName.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.AssemblyName
的用法示例。
在下文中一共展示了AssemblyName.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadFromFabricCodePath
private static Assembly LoadFromFabricCodePath(object sender, ResolveEventArgs args)
{
string assemblyName = new AssemblyName(args.Name).Name;
if (!assemblyName.Equals(ServiceModelAssemblyName))
{
return null;
}
try
{
string assemblyPath = Path.Combine(FabricCodePath, assemblyName + ".dll");
if (File.Exists(assemblyPath))
{
return Assembly.LoadFrom(assemblyPath);
}
}
catch (Exception)
{
// Suppress any Exception so that we can continue to
// load the assembly through other means
}
return null;
}
示例2: GetAssembly
public Assembly GetAssembly(AssemblyName name, bool throwOnError)
{
Assembly assembly = null;
if (this.cachedAssemblies == null)
{
this.cachedAssemblies = new Hashtable();
}
if (this.cachedAssemblies.Contains(name))
{
assembly = this.cachedAssemblies[name] as Assembly;
}
if (assembly == null)
{
assembly = Assembly.LoadWithPartialName(name.FullName);
if (assembly != null)
{
this.cachedAssemblies[name] = assembly;
return assembly;
}
if (this.names == null)
{
return assembly;
}
for (int i = 0; i < this.names.Length; i++)
{
if (name.Equals(this.names[i]))
{
try
{
assembly = Assembly.LoadFrom(this.GetPathOfAssembly(name));
if (assembly != null)
{
this.cachedAssemblies[name] = assembly;
}
}
catch
{
if (throwOnError)
{
throw;
}
}
}
}
}
return assembly;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:47,代码来源:AssemblyNamesTypeResolutionService.cs
示例3: GetAssembly
public Assembly GetAssembly(AssemblyName name, bool throwOnError) {
Assembly result = null;
if (cachedAssemblies == null) {
cachedAssemblies = Hashtable.Synchronized(new Hashtable());
}
if (cachedAssemblies.Contains(name)) {
result = cachedAssemblies[name] as Assembly;
}
if (result == null) {
// try to load it first from the gac
#pragma warning disable 0618
//Although LoadWithPartialName is obsolete, we still have to call it: changing
//this would be breaking in cases where people edited their resource files by
//hand.
result = Assembly.LoadWithPartialName(name.FullName);
#pragma warning restore 0618
if(result != null) {
cachedAssemblies[name] = result;
}
else if (names != null) {
for(int i=0;i<names.Length; i++) {
if(name.Equals(names[i])) {
try {
result = Assembly.LoadFrom(GetPathOfAssembly(name));
if(result != null) {
cachedAssemblies[name] = result;
}
}
catch {
if(throwOnError) {
throw;
}
}
}
}
}
}
return result;
}