get the Type for a object declared dynamic

You need to do this… Type unknown = ((ObjectHandle)tmp).Unwrap().GetType(); By the way, this is a little confusing because if you call Activator.CreateInstance on a type in your current assembly… Activator.CreateInstance(typeof(Foo)) …the object is not wrapped and the original code works fine.

How to bind DataTemplate datatype to interface?

You can bind to interfaces by telling wpf explicitly that you are binding to an interface field: (Please note that ViewModelBase is simply a base-class that implements the INotifyPropertyChanged interface) public class Implementation : ViewModelBase, IInterface { private string textField; public string TextField { get { return textField; } set { if (value == textField) … Read more

What is the differences between Int and Integer in Scala?

“What are the differences between Integer and Int?” Integer is just an alias for java.lang.Integer. Int is the Scala integer with the extra capabilities. Looking in Predef.scala you can see this the alias: /** @deprecated use <code>java.lang.Integer</code> instead */ @deprecated type Integer = java.lang.Integer However, there is an implicit conversion from Int to java.lang.Integer if … Read more

Which MySQL datatype to use for an IP address? [duplicate]

Since IPv4 addresses are 4 byte long, you could use an INT (UNSIGNED) that has exactly 4 bytes: `ipv4` INT UNSIGNED And INET_ATON and INET_NTOA to convert them: INSERT INTO `table` (`ipv4`) VALUES (INET_ATON(“127.0.0.1”)); SELECT INET_NTOA(`ipv4`) FROM `table`; For IPv6 addresses you could use a BINARY instead: `ipv6` BINARY(16) And use PHP’s inet_pton and inet_ntop … Read more

Returning function pointer type

int (*getFunc())(int, int) { … } That provides the declaration you requested. Additionally, as ola1olsson notes, it would be good to insert void: int (*getFunc(void))(int, int) { … } This says that getFunc may not take any parameters, which can help avoid errors such as somebody inadvertently writing getFunc(x, y) instead of getFunc()(x, y).