c# - Property or indexer 'System.DateTime.TimeOfDay' cannot be assigned to — it is read only -


i saw lots of duplicate post of me it's different.

i have datetime object , time portion & assign time that.when i'm going assign it raise error.

in here newstartdategroup datetime object in here opentime timespan

property or indexer cannot assigned — read only

else if(newstartdategroup.timeofday < i.opentime && newenddategroup.timeofday > i.closetime) // < >  {         newstartdategroup.timeofday = i.opentime; 

datetime struct in .net immutable, instead of changing it's values have create new one:

newstartdategroup = newstartdategroup.date.add(i.opentime); 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -