ForEachLoop.GetPackagePath 方法

定义

返回一个字符串,其中包含包位置的相对路径。

public:
 virtual System::String ^ GetPackagePath();
public string GetPackagePath ();
abstract member GetPackagePath : unit -> string
override this.GetPackagePath : unit -> string
Public Function GetPackagePath () As String

返回

包含包路径的字符串。

实现

示例

下面的代码示例创建一个 ForEachLoop,使用 Properties 集合设置一些属性,并检索包路径。

// Create the new package.  
Package package = new Package();  
// Add variables.  
package.Variables.Add("Id", false, "User", 0);  
// Create ForEachLoop task  
Executables executables = package.Executables;  
ForEachLoop forEachLoop = executables.Add("STOCK:FOREACHLOOP") as ForEachLoop;  
// Set properties on the ForEachLoop, like name and description.  
// Show how to set them using the Properties collection.  
forEachLoop.Properties["Name"].SetValue(forEachLoop, "ForEachLoop Container");  
forEachLoop.Properties["Description"].SetValue(forEachLoop, "ForEachLoop Container");  

// Retrieve the package path of the loop.  
String path = forEachLoop.GetPackagePath();  
Console.WriteLine("Package path: {0}", path);  
' Create the new package.  
Dim package As Package =  New Package()   
' Add variables.  
package.Variables.Add("Id", False, "User", 0)  
' Create ForEachLoop task  
Dim executables As Executables =  package.Executables   
Dim forEachLoop As ForEachLoop =  executables.Add("STOCK:FOREACHLOOP") as ForEachLoop   
' Set properties on the ForEachLoop, like name and description.  
' Show how to set them using the Properties collection.  
forEachLoop.Properties("Name").SetValue(forEachLoop, "ForEachLoop Container")  
forEachLoop.Properties("Description").SetValue(forEachLoop, "ForEachLoop Container")  

' Retrieve the package path of the loop.  
Dim path As String =  forEachLoop.GetPackagePath()   
Console.WriteLine("Package path: {0}", path)  

示例输出:

包路径:\Package\ForEachLoop 容器

适用于