When is a MailItem not a MailItem? [closed]

This code showed me the different TypeNames that were in my Inbox: Public Sub GetTypeNamesInbox() Dim myOlItems As Outlook.Items Set myOlItems = application.GetNamespace(“MAPI”).GetDefaultFolder(olFolderInbox).Items Dim msg As Object For Each msg In myOlItems Debug.Print TypeName(msg) ’emails are typename MailItem ‘Meeting responses are typename MeetingItem ‘Delivery receipts are typename ReportItem Next msg End Sub HTH

Get class name of object as string in Swift

String from an instance: String(describing: self) String from a type: String(describing: YourType.self) Example: struct Foo { // Instance Level var typeName: String { return String(describing: Foo.self) } // Instance Level – Alternative Way var otherTypeName: String { let thisType = type(of: self) return String(describing: thisType) } // Type Level static var typeName: String { return … Read more

‘typeid’ versus ‘typeof’ in C++

C++ language has no such thing as typeof. You must be looking at some compiler-specific extension. If you are talking about GCC’s typeof, then a similar feature is present in C++11 through the keyword decltype. Again, C++ has no such typeof keyword. typeid is a C++ language operator which returns type identification information at run … Read more

How to cast Object to its actual type?

If you know the actual type, then just: SomeType typed = (SomeType)obj; typed.MyFunction(); If you don’t know the actual type, then: not really, no. You would have to instead use one of: reflection implementing a well-known interface dynamic For example: // reflection obj.GetType().GetMethod(“MyFunction”).Invoke(obj, null); // interface IFoo foo = (IFoo)obj; // where SomeType : IFoo … Read more