PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are creating a Windows Workflow Foundation custom activity class
named FileTransfer by using Microsoft .NET Framework 3.5. You plan to add a dependency property named FileName of type string to the custom activity. You need to ensure that each time the FileName property is assigned an empty string value at design time, the workflow does not compile. Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
public static DependencyProperty FileNameProperty =
DependencyProperty.Register("FileName",typeof(string), typeof(FileTransfer), new PropertyMetadata(DependencyPropertyOptions.Default,new Attribute[] { new ContentPropertyAttribute()}));

B.
public static DependencyProperty FileNameProperty =
DependencyProperty.Register("FileName",typeof(string), typeof(FileTransfer),new PropertyMetadata( DependencyPropertyOptions.Default,new Attribute[] { new RequiredAttributeAttribute( typeof(FileTransfer) ) }));

C.
public static DependencyProperty FileNameProperty =
DependencyProperty.Register("FileName",typeof(string), typeof(FileTransfer),new PropertyMetadata(DependencyPropertyOptions.Metadata,new Attribute[] { new ValidationOptionAttribute( ValidationOption.Required)}));

D.
public static DependencyProperty FileNameProperty =
DependencyProperty.Register("FileName",typeof(string), typeof(FileTransfer), new PropertyMetadata( DependencyPropertyOptions.Default,new Attribute[] { new ActivityValidatorAttribute( typeof(FileTransfer))}));


Leave a Reply