C#中 property 与 attribute的区别,他们各有什么用处,这种机制的好处在哪里?
C#中 property 与 attribute的区别,他们各有什么用处,这种机制的好处在哪里?
相关考题:
Exhibit:You are creating a composite control for capturing user address information in a Web application. You define a number of properties that the user can set at design time. You need to group these properties in the Properties dialog box. In addition, you need to ensure that when users click on a particular property, they receive a short explanation of that property. The properties are shown in the exhibit. Which two actions should you perform?()A. Attach the Category attribute class to the controls class definition. Set its value to UserAddress. Mark the class as public.B. Attach the Browsable attribute class to each property in the group. Set its value to True. Mark the property as private.C. Attach the Category attribute class to each property in the group. Set its value to UserAddress. Mark the property as public.D. Attach the Description attribute class to each property in the group. Set each value to a description of the given property.E. Attach the DefaultProperty attribute class to each property in the group. Set each value to a description of the given property.
You are creating a Windows Communication Foundation (WCF) service that accepts messages from clients when they are started. The message is defined as follows:[MessageContract] public class Agent { A. Add a MessageBodyMember attribute to the CodeName property and set the ProtectionLevel to Sign. Add a MessageBodyMember attribute to the SecretHandshake property and set the ProtectionLevel to EncryptAndSign.B. Add a DataProtectionPermission attribute to the each property and set the ProtectData property to true.C. Add an xmlText attribute to the CodeName property and set the DataType property to Signed. Add a PasswordPropertyText attribute to the SecretHandshake property and set its value to true.D. Add an ImmutableObject attribute to the CodeName property and set its value property to true. Add a Browsable attribute to the SecretHandshake property and set its value to false.
C#中TestClass为一自定义类,其中有以下属性定义 publicvoidProperty{…} 使用以下语句创建了该类的对象,并使变量obj引用该对象: TestClassobj=newTestClass(); 那么,可通过什么方式访问类TestClass的Property属性?()A、Obj,Property;B、MyClass.Property;C、obj::Property;D、obj.Property;
You are creating a Windows Communication Foundation (WCF) service that accepts messages from clients when they are started. The message is defined as follows. [MessageContract] public class Agent { public string CodeName { get; set; }public string SecretHandshake { get; set; } } You have the following requirements: "The CodeName property must be sent in clear text. The service must be able to verify that the property value was not changed after being sent by the client. "The SecretHandshake property must not be sent in clear text and must be readable by the service. What should you do?() A、 Add a MessageBodyMember attribute to the CodeName property and set the ProtectionLevel to Sign. Add a MessageBodyMember attribute to the SecretHandshake property and set the protectionLevel to EncryptAndSign.B、 Add a DataProtectionPermission attribute to the each property and set the ProtectData property to true.C、 Add an XmlText attribute to the CodeName property and set the DataType property to Signed. add a PasswordPropertyText attribute to the SecretHandshake property and set its value to true.D、 Add an ImmutableObject attribute to the CodeName property and set its value property to true. Add a Browsable attribute to the SecretHandshake property and set its value to false.
单选题You are creating a Windows Communication Foundation (WCF) service that accepts messages from clients when they are started. The message is defined as follows. [MessageContract] public class Agent { public string CodeName { get; set; }public string SecretHandshake { get; set; } } You have the following requirements: "The CodeName property must be sent in clear text. The service must be able to verify that the property value was not changed after being sent by the client. "The SecretHandshake property must not be sent in clear text and must be readable by the service. What should you do?()A Add a MessageBodyMember attribute to the CodeName property and set the ProtectionLevel to Sign. Add a MessageBodyMember attribute to the SecretHandshake property and set the protectionLevel to EncryptAndSign.B Add a DataProtectionPermission attribute to the each property and set the ProtectData property to true.C Add an XmlText attribute to the CodeName property and set the DataType property to Signed. add a PasswordPropertyText attribute to the SecretHandshake property and set its value to true.D Add an ImmutableObject attribute to the CodeName property and set its value property to true. Add a Browsable attribute to the SecretHandshake property and set its value to false.
问答题C#中ref和out关键字有什么区别?