Main Site Documentation

What's the difference between I2CDevice.CreateReadTransaction() and new I2CDevice.I2CReadTransaction()


I’m looking into the I2C API, and I’m getting a bit confused. There seem to be multiple ways to create an I2C transaction.

I can either use the static I2CDevice.CreateReadTransaction method ( ), or create a new I2CDevice.I2CReadTransaction object ( ). I’m puzzled as to what the difference is. Both take the same number of arguments.

I asked this on StackOverflow as well, but got no response:

Which should I use, and why?


Maybe this would help?


Not really. I’ve managed to write the code, and I think I’ve worked out how Microsoft intended the transactions to be used (ie create them once, use them over and over again). I’d just like to know whether the code for I2CDevice does this behind the scenes, or if there’s more going on:

public static I2CWriteTransaction CreateWriteTransaction (byte[] buffer)
	return new I2CWriteTransaction(buffer)

To me, writing such a method seems like a serious mistake on microsoft’s part. Even from a shorthand point of view, it only saves one character.