Search the Community
Showing results for tags 'runtime'.
Found 2 results
Hi All. I'm developing a program in C#, which involves dynamic offsets (The user creates settings in the program which are saved to a file). The data the user inputs is The offset address (e.g. 0x02BC), The offset size / length (e.g. 4) The type of the output (e.g. int32, float32 etc.) Adjustments to be made to the end result (e.g / 256) Currently the program creates the offset, using the address and length. This works great and when manually specifying the type I can successfully get the value from the flight sim. Offset myOffset = new Offset("Main", OffsetAddress, OffsetLength); However I am not sure how I can go about using my type variable when getting the information int offsetValue = myOffset.GetValue<MyTypeHere>(); I get the error Type is a variable but used as a type. I have also tried typeof(MyTypeHere), and several other methods however I haven't been able to fix it. I am quite new to C# so apologies if this is a really stupid question. EDIT: I know I can use a switch(MyTypeHere) and then have a case for every single type, however I am trying to avoid this if possible. Thanks, Brad