您可以在 .NET 中克隆 CallingAssembly 对象吗?
Can You Clone The CallingAssembly Object In .NET?
我正在尝试捕获对象中的调用程序集,然后将其传递给随后将使用它的方法。
这是我正在尝试做的事情:
'This code is called from another assembly
Dim objCallingAssembly As Object = Assembly.GetCallingAssembly()
'The executing assembly now passes the clone to a method in its assembly
PopulateCallingAssembly (objCallingAssembly)
Private Sub PopulateCallingAssembly(objCallingAssembly As Object)
Dim strCallingAssemblyFileName = GetAssemblyFileName(objCallingAssembly.GetCallingAssembly().Location)
Dim strCallingAssemblyName = objCallingAssembly.GetCallingAssembly().GetName().Name
Dim strCAllingAssemblyVersion = objCallingAssembly.GetCallingAssembly().GetName().Version.ToString
End Sub
如何制作包含静态值且不会更改的调用程序集对象的克隆(或副本)?
这里发生的事情太复杂了。你只需要
'This code is called from another assembly
Dim objCallingAssembly As Assembly = Assembly.GetCallingAssembly()
'The executing assembly now passes the clone to a method in its assembly
PopulateCallingAssembly (objCallingAssembly)
Private Sub PopulateCallingAssembly(objCallingAssembly As Assembly)
Dim strCallingAssemblyFileName = objCallingAssembly.Location)
Dim strCallingAssemblyName = objCallingAssembly.GetName().Name
Dim strCAllingAssemblyVersion = objCallingAssembly.GetName().Version.ToString()
End Sub
我正在尝试捕获对象中的调用程序集,然后将其传递给随后将使用它的方法。
这是我正在尝试做的事情:
'This code is called from another assembly
Dim objCallingAssembly As Object = Assembly.GetCallingAssembly()
'The executing assembly now passes the clone to a method in its assembly
PopulateCallingAssembly (objCallingAssembly)
Private Sub PopulateCallingAssembly(objCallingAssembly As Object)
Dim strCallingAssemblyFileName = GetAssemblyFileName(objCallingAssembly.GetCallingAssembly().Location)
Dim strCallingAssemblyName = objCallingAssembly.GetCallingAssembly().GetName().Name
Dim strCAllingAssemblyVersion = objCallingAssembly.GetCallingAssembly().GetName().Version.ToString
End Sub
如何制作包含静态值且不会更改的调用程序集对象的克隆(或副本)?
这里发生的事情太复杂了。你只需要
'This code is called from another assembly
Dim objCallingAssembly As Assembly = Assembly.GetCallingAssembly()
'The executing assembly now passes the clone to a method in its assembly
PopulateCallingAssembly (objCallingAssembly)
Private Sub PopulateCallingAssembly(objCallingAssembly As Assembly)
Dim strCallingAssemblyFileName = objCallingAssembly.Location)
Dim strCallingAssemblyName = objCallingAssembly.GetName().Name
Dim strCAllingAssemblyVersion = objCallingAssembly.GetName().Version.ToString()
End Sub