variant

How to return the equivalent of a VB6 Variant type from a method in C#

烂漫一生 提交于 2019-11-27 04:53:03
问题 I have an older VB6 app that has a function RunReturningVAR it is a db call that could return an int , string , double ..... but not a RecordSet . It was built very generically so that it can be called by multiple other functions so we don't have multiple locations for DB calls. what I currently have is attached. Public Function RunReturningVar(ByVal vstrSql As String, _ Optional ByVal connval As Boolean = False, _ Optional ByVal copyID As Double = 0, _ Optional ByVal corpVal As Boolean =

C++ Variant

折月煮酒 提交于 2019-11-27 04:25:26
问题 I'm in the process of creating a class that stores metadata about a particular data source. The metadata is structured in a tree, very similar to how XML is structured. The metadata values can be integer, decimal, or string values. I'm curious if there is a good way in C++ to store variant data for a situation like this. I'd like for the variant to use standard libraries, so I'm avoiding the COM, Ole, and SQL VARIANT types that are available. My current solution looks something like this:

How do I represent an Optional String in Go?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 22:01:47
问题 I wish to model a value which can have two possible forms: absent, or a string. The natural way to do this is with Maybe String , or Optional<String> , or string option , etc. However, Go does not have variant types like this. I then thought, following Java, C, etc., that the alternative would be nullability, or nil in Go. However, nil is not a member of the string type in Go. Searching, I then thought to use the type *string . This could work, but seems very awkward (e.g. I cannot take the

What are the differences between std::variant and boost::variant?

有些话、适合烂在心里 提交于 2019-11-26 21:46:47
问题 In an answer to this SO question: What is the equivalent of boost::variant in the C++ standard library? it is mentioned that boost::variant and std::variant differ somewhat. What are the differences, as far as someone using these classes is concerned? What motivation did the committee express to adopt std::variant with these differences? What should I watch out for when coding with either of these, to maintain maximum compatibility with switching to the other one? (the motivation is using

How to return the number of dimensions of a (Variant) variable passed to it in VBA

两盒软妹~` 提交于 2019-11-26 18:55:11
Does anyone know how to return the number of dimensions of a (Variant) variable passed to it in VBA? Jacob Function getDimension(var As Variant) As Long On Error GoTo Err Dim i As Long Dim tmp As Long i = 0 Do While True i = i + 1 tmp = UBound(var, i) Loop Err: getDimension = i - 1 End Function That's the only way I could come up with. Not pretty…. Looking at MSDN, they basically did the same. To return the number of dimensions without swallowing errors: #If VBA7 Then Private Type Pointer: Value As LongPtr: End Type Private Declare PtrSafe Sub RtlMoveMemory Lib "kernel32" (ByRef dest As Any,

What&#39;s the difference between <h:head> and <head> in Java Facelets?

。_饼干妹妹 提交于 2019-11-26 14:36:52
问题 See this. When and why to use <h:head> , instead of <head> ? I've seen Primefaces won't work with <head> , though. 回答1: The <head> tag is a HTML tag, which defines the head of the HTML page (this is where you define metadata, or include the resources such as JavaScript or CSS for example). The <h:head> is a JSF tag (introduced with JSF 2.0) that handles the <head> part of your page. The interest of having such JSF tag is that this head becomes part of your JSF components tree, and thus, you

How to return the number of dimensions of a (Variant) variable passed to it in VBA

☆樱花仙子☆ 提交于 2019-11-26 06:43:33
问题 Does anyone know how to return the number of dimensions of a (Variant) variable passed to it in VBA? 回答1: Function getDimension(var As Variant) As Long On Error GoTo Err Dim i As Long Dim tmp As Long i = 0 Do While True i = i + 1 tmp = UBound(var, i) Loop Err: getDimension = i - 1 End Function That's the only way I could come up with. Not pretty…. Looking at MSDN, they basically did the same. 回答2: To return the number of dimensions without swallowing errors: #If VBA7 Then Private Type Pointer