Microsoft.Cci.MetadataReaderHost.GuessUnderlyingTypeSizeOfUnresolvableReferenceToEnum C# (CSharp) Method

GuessUnderlyingTypeSizeOfUnresolvableReferenceToEnum() public method

Returns a guess of the size of the underlying type of the given type reference to an enum type, which is assumed to be unresolvable because it is defined an assembly that is not loaded into this host. Successive calls to the method will cycle through these values with a periodicity determined by the number of types in the game and the successful guesses made in earlier games.
public GuessUnderlyingTypeSizeOfUnresolvableReferenceToEnum ( ITypeReference reference ) : byte
reference ITypeReference A type reference that cannot be resolved.
return byte
    public byte GuessUnderlyingTypeSizeOfUnresolvableReferenceToEnum(ITypeReference reference) {
      uint rkey = reference.InternedKey;
      byte guess;
      if (this.currentGoodGuesses != null && this.currentGoodGuesses.TryGetValue(rkey, out guess))
        return guess;
      if (this.currentWildGuesses != null && this.currentWildGuesses.TryGetValue(rkey, out guess))
        return guess;
      if (this.successfulGuesses != null && this.successfulGuesses.TryGetValue(rkey, out guess)) {
        if (this.currentGoodGuesses == null) this.currentGoodGuesses = new Dictionary<uint, byte>();
        this.currentGoodGuesses[rkey] = guess;
        return guess;
      }
      if (this.currentWildGuesses == null) this.currentWildGuesses = new Dictionary<uint, byte>();
      this.currentWildGuesses[rkey] = 4;
      return 4;
    }