ToBool
DocumentProperty.ToBool method
Özellik değerini bool. olarak döndürür
public bool ToBool()
Notlar
Özellik türü değilse bir istisna atarBoolean.
Örnekler
Özel belge özelliklerinin çeşitli tür dönüştürme yöntemlerini gösterir.
Document doc = new Document();
CustomDocumentProperties properties = doc.CustomDocumentProperties;
DateTime authDate = DateTime.Today;
properties.Add("Authorized", true);
properties.Add("Authorized By", "John Doe");
properties.Add("Authorized Date", authDate);
properties.Add("Authorized Revision", doc.BuiltInDocumentProperties.RevisionNumber);
properties.Add("Authorized Amount", 123.45);
Assert.AreEqual(true, properties["Authorized"].ToBool());
Assert.AreEqual("John Doe", properties["Authorized By"].ToString());
Assert.AreEqual(authDate, properties["Authorized Date"].ToDateTime());
Assert.AreEqual(1, properties["Authorized Revision"].ToInt());
Assert.AreEqual(123.45d, properties["Authorized Amount"].ToDouble());
Ayrıca bakınız
- class DocumentProperty
- ad alanı Aspose.Words.Properties
- toplantı Aspose.Words