DtsProperty.Get 属性

定义

返回一个布尔值,该值指示是否可以读取属性值。 此字段为只读。

public:
 property bool Get { bool get(); };
public bool Get { get; }
member this.Get : bool
Public ReadOnly Property Get As Boolean

属性值

Boolean

指示是否可以读取值的布尔值。

示例

下面的代码示例创建包并添加大容量插入任务。 然后,它将获取 Properties ,并查看 GetSet 属性值以及属性名称。

using System;  
using System.Collections.Generic;  
using System.Text;  
using Microsoft.SqlServer.Dts.Runtime;  

namespace Executables_API  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            Package pkg = new Package();  
            Executable exec = pkg.Executables.Add("STOCK:BulkInsertTask");  

            // Obtain the collection.  
            Executables pgkExecs = pkg.Executables;  
            foreach (Executable eachExec in pgkExecs)  
            {  
                TaskHost th = exec as TaskHost;  
                Console.WriteLine("Executable creation name is: {0}", th.CreationName);  
            }  

            // Show use of Contains.  

            if (pgkExecs.Contains(0))  
                {  
                // Retrieve executable using [item] syntax.  
                Executable execItem = pgkExecs[0];  
                TaskHost thItem = execItem as TaskHost;  
                DtsProperties myProps = thItem.Properties;  
                foreach (DtsProperty dtsProp in myProps)  
                {  
                    Console.WriteLine("Name {0}, Get? {1} Set? {2}", dtsProp.Name, dtsProp.Get, dtsProp.Set);  
                }  
                Console.WriteLine("Contains returned true");  
            }  
            else  
            {  
                Console.WriteLine("Contains returned false");  
            }  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Namespace Executables_API  
    Class Program  
        Shared  Sub Main(ByVal args() As String)  
            Dim pkg As Package =  New Package()   
            Dim exec As Executable =  pkg.Executables.Add("STOCK:BulkInsertTask")   

            ' Obtain the collection.  
            Dim pgkExecs As Executables =  pkg.Executables   
            Dim eachExec As Executable  
            For Each eachExec In pgkExecs  
                Dim th As TaskHost =  exec as TaskHost   
                Console.WriteLine("Executable creation name is: {0}", th.CreationName)  
            Next  

            ' Show use of Contains.  

            If pgkExecs.Contains(0) Then  
                ' Retrieve executable using [item] syntax.  
                Dim execItem As Executable =  pgkExecs(0)   
                Dim thItem As TaskHost =  execItem as TaskHost   
                Dim myProps As DtsProperties =  thItem.Properties   
                Dim dtsProp As DtsProperty  
                For Each dtsProp In myProps  
                    Console.WriteLine("Name {0}, Get? {1} Set? {2}", dtsProp.Name, dtsProp.Get, dtsProp.Set)  
                Next  
                Console.WriteLine("Contains returned true")  
            Else   
                Console.WriteLine("Contains returned false")  
            End If  
        End Sub  
    End Class  
End Namespace  

示例输出:

Executable creation name is: Microsoft.SqlServer.Dts.Tasks.BulkInsertTask.BulkInsertTask, Microsoft.SqlServer.BulkInsertTask, Version=10.0.000.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91

Name BatchSize, Get? True Set? True

Name CheckConstraints, Get? True Set? True

Name CodePage, Get? True Set? True

Name CreationName, Get? True Set? False

Name DataFileType, Get? True Set? True

Name DebugMode, Get? True Set? True

Name DelayValidation, Get? True Set? True

Name Description, Get? True Set? True

Name FormatFile, Get? True Set? True

Name WaitForMe, Get? True Set? False

Contains returned true

注解

true当应用程序可以提取被引用对象属性的值时,此属性返回。 如果 false 为,则引用的属性是只写的。 尝试获取属性值将失败。

适用于