Skip to main content
added some formatting
Source Link
Malachi
  • 29.1k
  • 11
  • 87
  • 188

How about this:

To Save:To Save:

Settings.Default.blEnabled = string.Join(",", blenabled.Select(x=>x?"1":"0")); 

To Load:To Load:

if(!string.IsNullOrWhitespace(Settings.Default.blEnabled)) blenabled = Settings.Default.blEnabled .Split(',') .Select(x=>Convert.ToBoolean(int.Parse(x))) .ToList(); 

Is there some requirement that you save them as integers? It could be further simplified by just using bool.ToString()bool.ToString() and bool.Parse()bool.Parse()...

How about this:

To Save:

Settings.Default.blEnabled = string.Join(",", blenabled.Select(x=>x?"1":"0")); 

To Load:

if(!string.IsNullOrWhitespace(Settings.Default.blEnabled)) blenabled = Settings.Default.blEnabled .Split(',') .Select(x=>Convert.ToBoolean(int.Parse(x))) .ToList(); 

Is there some requirement that you save them as integers? It could be further simplified by just using bool.ToString() and bool.Parse()...

How about this:

To Save:

Settings.Default.blEnabled = string.Join(",", blenabled.Select(x=>x?"1":"0")); 

To Load:

if(!string.IsNullOrWhitespace(Settings.Default.blEnabled)) blenabled = Settings.Default.blEnabled .Split(',') .Select(x=>Convert.ToBoolean(int.Parse(x))) .ToList(); 

Is there some requirement that you save them as integers? It could be further simplified by just using bool.ToString() and bool.Parse()...

deleted 52 characters in body
Source Link

How about this:

To Save:

var values = blenabled .Select(x=>x?"1":"0") .ToArray(); Settings.Default.blEnabled = string.Join(values, ",", blenabled.Select(x=>x?"1":"0")); 

To Load:

if(!string.IsNullOrWhitespace(Settings.Default.blEnabled)) blenabled = Settings.Default.blEnabled .Split(',') .Select(x=>Convert.ToBoolean(int.Parse(x))) .ToList(); 

Is there some requirement that you save them as integers? It could be further simplified by just using bool.ToString() and bool.Parse()...

How about this:

To Save:

var values = blenabled .Select(x=>x?"1":"0") .ToArray(); Settings.Default.blEnabled = string.Join(values, ","); 

To Load:

if(!string.IsNullOrWhitespace(Settings.Default.blEnabled)) blenabled = Settings.Default.blEnabled .Split(',') .Select(x=>Convert.ToBoolean(int.Parse(x))) .ToList(); 

Is there some requirement that you save them as integers? It could be further simplified by just using bool.ToString() and bool.Parse()...

How about this:

To Save:

Settings.Default.blEnabled = string.Join(",", blenabled.Select(x=>x?"1":"0")); 

To Load:

if(!string.IsNullOrWhitespace(Settings.Default.blEnabled)) blenabled = Settings.Default.blEnabled .Split(',') .Select(x=>Convert.ToBoolean(int.Parse(x))) .ToList(); 

Is there some requirement that you save them as integers? It could be further simplified by just using bool.ToString() and bool.Parse()...

Source Link

How about this:

To Save:

var values = blenabled .Select(x=>x?"1":"0") .ToArray(); Settings.Default.blEnabled = string.Join(values, ","); 

To Load:

if(!string.IsNullOrWhitespace(Settings.Default.blEnabled)) blenabled = Settings.Default.blEnabled .Split(',') .Select(x=>Convert.ToBoolean(int.Parse(x))) .ToList(); 

Is there some requirement that you save them as integers? It could be further simplified by just using bool.ToString() and bool.Parse()...