Ad
  • Custom User Avatar

    You're not supposed to create in instance. The kata only asks that you create a Type. The example in the description does not make this 100% clear; the only thing you're supposed to implement is Kata.DefineClass(). If you look closely at the signature of that method, you'll see that the last parameter is ref myType. The ref modifier should tell you that your method needs to create and assign a Type object to that argument.
    The author supplies CreateInstance and uses it from within the tests (similar to how you are doing it in your code, but you are not supposed to).

    As for your error messages: they clearly point out where the error is happening: SomeObject. You are trying to access these properties from Console.WriteLine(...). Remove those lines and the error will go away. Not sure why you're trying to get randomly named properties on a type that you just created, without checking whether those properties were even included in the provided dictionary. Also: trying to read a property value of a type when that property isn't set to static obviously can't work, hence the compiler complains that it needs an instance of that type.

    Oh, and one more thing: think about when and where you want to create a new Assembly.

  • Custom User Avatar

    Your solution does not exactly realize the task.

    You need to create a new type, which will contain requested properties. What you are doing, though, is returning ExpandoObject type every time. It's true that instances of this type allow for adding arbitrary properties, but these properties are added to instances, and not to the overall type.

  • Custom User Avatar

    else if (bitIndex > binValueList.Count)
    {
    result.Append(binValue.Insert(0, "1"));
    }
    in this line you add one bit in the beginning of result, But tests can be like this: FlipBit(127,17).In that case you should flip 17th bit of 8bit number, but in your code you flip 9th bit

  • Custom User Avatar

    forum is not dead!)
    on that line -> if (binValueList != null && bitIndex <= binValueList.Count) you check for bitIndex <= binValuelist.Count,
    but test cases can be like this : FlipBit(1,2) and bitIndex can be > than binValuelist.Count,
    so your result become empty and in that line -> int testBin = Convert.ToInt32(result.ToString(), 2); you have error.