Please help me understand:
print gettype(new CustomerObject())
prints: "object" (so it is an object)
BUT
print gettype((new CustomerObject())->get_customer());
prints: unexpected T_OBJECT_OPERATOR
If I do it over two lines it works fine
$object = new Customer($order->customer_id);
print gettype($object);
prints: object
$cus...
I have tried this, specifying the assembly name:
Type.GetType(string.Format("{0}.{1}, {0}", typeToLoad.AssemblyName, typeToLoad.ClassName));
Which throws the following:
The requested assembly version conflicts with what is already bound in the app domain or specified in the manifest
Trying the same without including the trailing...
Hello everybody
I have code that gives a list of all possible values for any given enum
i bound it pretty often to dropdownlists in my webpages
now im trying to make a usercontrol which accepts the type name as a parameter, which in turn calls the code to create the value list
as my sub expects a type parameter
Shared Function EnumLis...
Hello all,
Since I can't make any comments (only post an answer) to this post, I'll post a new question.
I followed the instructions from mentioned post, but the code produces an error.
The code:
Type t = Type.GetType(className);
Type listType = typeof(List<>).MakeGenericType(t);
IList list = (IList)Activator.CreateInstance(listType)...
public string[] tName = new string[]{"Whatever","Doesntmatter"};
string vBob = "Something";
string[] tVars = new string[]{"tName[0]","vBob","tName[1]"};
Now, I want to change the value of tName[0], but it doesnt work with:
for(int i = 0; i < tVars.Lenght;++i)
{
this.GetType().GetField("tVars[0]").SetValue(this, ValuesThatComeFromS...
If I have a list...
dim l as List(of MyClass) = new List(of MyClass)
and I want to get the type of the objects contained in the list, how do I do that?
The obvious answer, that doesn't seem to be possible from my actual implementation, would be to do something like this...
public function GetType(byval AList as IList(of GenericType)...
I have come across a strange behaviour in my (huge) .NET 4 project. At some point in the code, I am referring to a fully qualified type, say:
System.Type type = typeof (Foo.Bar.Xyz);
later on, I do this:
System.Type type = System.Type.GetType ("Foo.Bar.Xyz");
and I get back null. I cannot make sense of why this is happening, becaus...
I have an iterator of objects and I have to take specific action if the item is of some type. That type is a friend class in the runtime, and therefore cannot be used in design-time.
So my question is, which of the following will cost less performance:
Private Const myType As String = "System.HiddenNameSpace.MyHiddenType"
Sub Compare()...