templates - C# templated / generic method at compile time error -


I am working with .NET 2.0 in C # (I know this)

This is my setup:

  struct asset type {System.type type; } Public Sector Debt Techniques {Private Dictionary & lt; Property Type, Object & gt; a quality; Public Zero Set Property (property type key, object value) {if (value.getType == key.type) // Make sure that they are adding valid data properties. Add (key, value); } Public T GetProperty & lt; T & gt; (Property type key) {return (t) properties [key]; }}  

Then there is a need to pull the properties in my class, it looks like

  //, it is used somewhere else for use by many classes Will be announced. // But for example here hash hash type hash; Hash Type = typef (byte []); Byte [] Hashod = Dataset Properties GetProperty & lt; Hash.type & gt; (Hash);  

Now the last line is that which does not work, but I would like to work. I think the problem is that it's not like typing in the form of being a variable. Many different properties will be type objects in actual use, so I want a way to exclude the properties and easily put the right type

Does anyone know if it is certain that this type of As the variable is problem, but compiling time, it will know whether the hash is so kind that it is not unknown in its compilation time.

"post-text" itemprop = "text">

No, it is an unknown value at compile time, as long as The compiler is concerned. Just because you set it to the previous line does not mean that the compiler actually knows the value.

You can not use the variable to specify type logic in C # generic, except for reflection, a type argument must be named in some way or other type of parameter - this is not an expression Which is System.Type .


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -