public static IAssemblyReference GetAssemblyReference(this IReference reference) { Contract.Requires(reference != null); Contract.Requires(!(reference is Dummy)); IAssemblyReference assembly = reference as IAssemblyReference; if (assembly != null) { return(assembly); } ITypeReference type = reference as ITypeReference; if (type != null) { return(type.GetAssemblyReference()); } ITypeMemberReference member = reference as ITypeMemberReference; if (member != null) { return(member.ContainingType.GetAssemblyReference()); } throw new NotSupportedException(string.Format("Unknown IReference '{0}' so we cannot get assembly reference!", reference.GetType().FullName)); }
public static IAssemblyReference GetAssemblyReference(this IReference reference) { Contract.Requires(reference != null); Contract.Requires(!(reference is Dummy)); IAssemblyReference assembly = reference as IAssemblyReference; if (assembly != null) { return(assembly); } ITypeReference type = reference as ITypeReference; if (type != null) { return(type.GetAssemblyReference()); } ITypeMemberReference member = reference as ITypeMemberReference; if (member != null) { return(member.ContainingType.GetAssemblyReference()); } throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, LocalizedStrings.UnknownIReference, reference.GetType().FullName)); }
private void AddTypeReference(ITypeReference type) { Contract.Assert(type == type.UnWrap()); _typeReferences.Add(type); IAssemblyReference asmRef = type.GetAssemblyReference(); if (asmRef != null) { _assemblyReferences.Add(asmRef); } }
public static bool IsWindowsRuntimeType(this ITypeReference type) { IAssemblyReference assemblyRef = type.GetAssemblyReference(); return(assemblyRef.IsWindowsRuntimeAssembly()); }