types

C# - method behaviour that depends on the expected type

Is it possible to write in C# method in such a way that when I write String contestId = getParameter("contestId") i get contestId in string, but when I write: int contestId = getParameter("contestId") i get contestId parsed to integer? This is only simple example showing what i try to achieve. ...

strange boolean expression solving in php

$foo = 0; if($foo == 'on') $foo = 1; echo $foo; It should be expected the above code outputs "0". However it doesn't, somehow $foo == 'on' results in TRUE, although this obviously is wrong. Replacing the expression with $foo === 'on' gives the right answer, so any suspicions this might be some typing issue seem to be confirmed. Neve...

Why is my VB6 variant changing depending on when it is assigned?

I am new to VB6 (and visual basic in any form) development and I've come across a problem. There may be lexical errors below because I formatted the code to be a little more readable inside of the post here, but the essence of the question remains. Here is the code My problem is that the values displayed by the MsgBox calls (the second ...

Help converting type - cannot implicitly convert type 'string' to 'bool'

Hi all, I am fairly new to c# and asp.net and am having an issue converting type; My situation is that I have a search engine that has a textbox for the search text and two radio buttons for the search location ( IE City1 or City2 ) When I recieve the search text and radio buttons they are in the form of a string IE string thesearcht...

SSIS 2008 Execute SQL output parameter mapping datetime2 problem

Hi, I'm trying to use an Execute SQL Task in SSIS 2008 to map a store procedure output parameter to a package variable. The package variable is SSIS type DateTime and the store procedure parameter is SQL type DATETIME. The SQL Statement is EXEC GetCurrentDate @CurrentDate=? and in the parameter mapping screen, the parameter is mapped t...

Is there a better/best way to determine the type of a passed object in VB.NET?

I am still developing this function, but here is what I am intending it to do. This function will accept an Object, then try to determine its type. There are a specific set of types I am looking for: Integer, Boolean, Date, String. What I have so far is pretty privative, but it seems to be working so far: Private Function DataType(ByVa...

C#: Restricting Types in method parameters (not generic parameters)

I'd like to code a function like the following public void Foo(System.Type t where t : MyClass) { ... } In other words, the argument type is System.Type, and I want to restrict the allowed Types to those that derive from MyClass. Is there any way to specify this syntactically, or does t have to be checked at runtime? ...

Should I use an interface for Type Codes?

I am working on a project that has several different codes. These codes all basically are used this way: CodeKey Description GetList GetSpecific SetProperties All of my classes implement this. I am hesitent, however, to use an interface because of one problem--the type Codes vary by type. Some are strings, some are integers, some a...

How to return an interface type without mentioning the derived class name?

Hi all, I'm looking for a way to not reference the class name, yet still achieve the desired effect. I can't do ITypedList.GetType() because it is an Interface. public class DerivedList : ITypedList ... public PropertyDescriptorCollection GetItemProperties() { return TypeDescriptor.GetProperties(typeof(DerivedList)); } ...

proofs about regular expressions

Does anyone know any examples of the following? Proof developments about regular expressions (possibly extended with backreferences) in proof assistants (such as Coq). Programs in dependently-typed languages (such as Agda) about regular expressions. ...

difference in long vs int data types in C++

What's the difference between int and long in C++ since both: sizeof(int) ... and sizeof(long) return 4? ...

How can I convert from an array of struct to array of Point3D ?

Hi All, I want to convert an array of struct to array of Point3D. The code snippet is as follows : class Mymesh { public MeshGeometry3D Mesh3D // Properties tanimlaniyor { get { return GetMesh3D(); } } public struct mystruct { public int m_i; public int m_j; public int m_k; public mystruct(int i, ...

(SWIG / Lua) How to access the list of base / parent classes in swig_lua_class

I notice that in the generated SWIG wrappers for a given set of classes, SWIG keeps a list of C-string representations of all the parent classes from which that class inherits. (char ** base_names). I know there is a function swig_type(some_variable) that will return a string representation of a given variable's data type. Is there al...

SharePoint Server 2k7 / Office 2003 Integration problem (CT prob.)

I have a bit of problem with MOSS (uptodate under 2003 r2) and Office 2003 integration. Customer particularly wants Office 2003. Problem So, when you make "new" document in the document center and document template is triggered and you hit "ok". In here everything is fine. Your doc is read and you hit "save" in Office Word 2003 and t...

.Net Use Reflection To Define OfType

I am using System.Reflection to load a type that I cannot otherwise load during design time. I need to pull all controls within a collection of this type, however, i the OfType command doesn't seem to like the reflection Syntax. here is "close to" what I got. Dim ControlType As Type = System.Reflection.Assembly.GetAssembly( _ ...

The Sample Project I can examine OOP in Details

Hi, I've working on Interfaces and Class and Structs types and I really wanna learn advanced yet simple patterns to understand those types correctly and use them efficiently. Is there any you know ? ...

Is there a better way than int( byte_buffer.encode('hex'), 16 )

In Python, I'm constantly using the following sequence to get an integer value from a byte buffer (in python this is a str). I'm getting the buffer from the struct.unpack() routine. When I unpack a 'char' using byte_buffer, = struct.unpack('c', raw_buffer) int_value = int( byte_buffer.encode('hex'), 16 ) Is there a better way? ...

C# Generics methods and returning a object of a parameterized type created in the method from xml

Hi, I have a method where I would like to return an object instance of parameterized type T ie. Foo<T>. The type T is instantiated within the method using GetType(), from a string element in an XML file. Since neither the class or method knows about it before it is created, I cant parameterize either. Is there a way I can return an o...

Automatic properties and Nullable types - are they incompatible?

I have a custom type with a nullable property that I am trying to project into from a nullable column in SQL. I am always getting a 'missingmethodexception' like so: {"Method not found: 'Void MyType.set_Number(System.Nullable`1<Int32>)'."} Is there a problem with trying to project into a custom type with nullable automatic properties?...

Oracle Associative Array TYPE is not able to use in USING statement (If TYPE is declared within Package)

Hi All, If 'Associative Array variable' is declared globally, able to use that in OPEN CURSOR USING statement. If 'Associative Array variable' is declared within package, while use in OPEN CURSOR USING statement, getting compilation error. More details provided below I am storing some values in one Associative Array variable. Late...