visual studio 2010 - Is there any alternative to Constant in C#? -
i creating program using microsoft xna , kinect. want width of skeleton. have skeleton right , left hand points. subtract them , width of skeleton. want store value in constant wont change if skeleton moves anywhere.
i have written following code giving me following error message. kindly tell me alternative or guide me how use constant
joint hand = skl.joints[jointtype.handright]; depthimagepoint rightshoulderpt = sensor.coordinatemapper.mapskeletonpointtodepthpoint(rightshoulder.position, depthimageformat.resolution640x480fps30); depthimagepoint leftshoulderpt = sensor.coordinatemapper.mapskeletonpointtodepthpoint(leftshoulder.position, depthimageformat.resolution640x480fps30);
edit //e.g //these values continuously changing based on skeleton position. want freeze //these points , store them in variable.
rightshoulderpt.x= 200; leftshoulderpt.x = 450;
const float totalwidth = rightshoulderpt.x - leftshoulderpt.x;
error 1 expression being assigned 'totalwidth' must constant
just never change value. constant
keyword meant compile-time constants, not runtime!
you use readonly
, assign value in constructor. other that, don't think there's specific keyword situation.
Comments
Post a Comment