-->

Welcome to our Coding with python Page!!! hier you find various code with PHP, Python, AI, Cyber, etc ... Electricity, Energy, Nuclear Power

Tuesday 3 July 2018

C# | Better way of parsing string to boolean

At the moment I am using this to check a boolean property in sharepoint 2007 using C# and .Net Framework 3.5

if (bool.Parse(listItem.Properties["Boolean Property"].ToString()) == false)
is there any better way of doing it ?
Edit
when my code try to convert property into string it gives me exception even when am validating if property is empty or not.
This Worked For me
using method "Contains Key" instead of "Properties.Containsfield"
object abc = "bool property";

foreach (SPListItem item in list.Items)
{
     if (item.Properties.ContainsKey(abc)

No comments:

Post a Comment

Thanks for your comments

Rank

seo