Use of anassigned local variable

Results 1 to 3 of 3
  1. #1
    SkullCrasher Neliel Tu is offline
    True MemberRank
    Jul 2012 Join Date
    Japan, TokyoLocation
    1,182Posts

    Use of anassigned local variable

    Hey Guys I Have A Problem In A C# Function

    CS0165 Use of unassigned local variable 'length1'
    while ((this.left -= length1) != 0);
    this.mode = this.last != 0 ? InflateBlocks.InflateBlockMode.DRY : InflateBlocks.InflateBlockMode.TYPE;
    continue;
    any idea?


  2. #2
    Account Upgraded | Title Enabled! jonnybravo is offline
    True MemberRank
    Sep 2006 Join Date
    766Posts

    Re: Use of anassigned local variable

    be nice if you showed what "left" "mode" "last" "length1" where as variables.

    but...

    Code:
    var length1 = null;
    while ((this.left -= length1) != 0);this.mode = this.last != 0 ? InflateBlocks.InflateBlockMode.DRY : InflateBlocks.InflateBlockMode.TYPE;
    continue;
    complier is telling you it has no idea what length1 is? sign it a null variable or a zero.

  3. #3
    Ultimate Member GHOST107 is offline
    MemberRank
    Oct 2008 Join Date
    172Posts

    Re: Use of anassigned local variable

    does length1 has a value?

    CS0165 Use of unassigned local variable 'length1'
    Means you declared the variable length1 but you didn't assign a value to it.



Advertisement