About 36,400 results
Open links in new tab
  1. In TypeScript, what does <T> mean? - Stack Overflow

    Apr 3, 2018 · Meaning Array<T> is the interface (for lack of a better word) and when we create a concrete type we replace T with a declared type: Array<number> So for the interface Array<T> what makes more sense than T? I don't know. I do know that T has to be a Type (number, string, etc) so it makes sense to use T because it the first letter of the word Type.

  2. stl - C++ type suffix _t, _type or none - Stack Overflow

    Oct 16, 2014 · This is readable and descriptive, and the added verbosity is not usually a problem because users don't normally spell out those type names: most of them are used in function signatures, then auto takes care of member function return types, and in C++14 the _t type aliases take care of type trait static type members.

  3. How do I get a class instance of generic type T?

    Aug 9, 2010 · Now you can retrieve the type of T at runtime: Type mySuperclass = myFoo.getClass().getGenericSuperclass(); Type tType = ((ParameterizedType)mySuperclass).getActualTypeArguments()[0]; Note however that mySuperclass has to be the superclass of the class definition actually defining the final type for T.

  4. c# - Pass Type dynamically to <T> - Stack Overflow

    Aug 18, 2009 · Now i dont know what Type may come to me to be passed to GetXML method. I have a method which will call GetXML for different Types e.g. Roles, Users etc. now i can get the Type within the List<> like this. Type genericType = obj.GetType().GetGenericArguments()[0]; but cannot pass it like this. string xml = GetXML<genericType>(myRoledata);

  5. json - Type '{}' is not assignable to type 'IntrinsicAttributes ...

    Jan 13, 2018 · I solved a lot of "not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes" type of errors (Microsoft closed issue) just by declaring an object that is passed entirely to the component. With the OP's example, instead of using term={this.props.term}, use {...searchBarProps} to get it working:

  6. The type or namespace name 'T' could not be found

    Jun 21, 2012 · public static class Utility { public static IEnumerable<T> Filter1<T>( // Type argument on the function this IEnumerable<T> input, Func<T, bool> predicate) { If you dont care if its an extension method or not, you can add a generic constrain to the class.

  7. The type 'T' cannot be used as type parameter in the generic type …

    Nov 6, 2012 · The compiler has no way to know that T, which is currently constraint to Base is actually Concrete, and that even if you test it before. So: Type type = typeof(Bar<>); Type generic = type.MakeGenericType(typeof(T)); var x = Activator.CreateInstance(generic); Don't let it …

  8. How to get the type of T from a member of a generic class or …

    public class Foo { public void Bar<T>() { var baz = new List<T>(); // get type of T } } I would like to know what type of objects the list of my class contains. So what type of T does the list property called Bar or the local variable baz contain?

  9. What does "The type T must be a reference type in order to use it …

    Jul 20, 2016 · They apparently have a constraint on the generic type. All you need to change is: public class GenericRecordController<T> : Controller where T : class This tells the compiler that only reference types may be supplied as a type for T.

  10. java - Troubleshooting "The type parameter T is hiding the type T ...

    Dec 13, 2015 · The warning appears at 'T' in 'A' and reads: "The type parameter T is hiding the type T". The weird part is that the following code generates no errors or warnings. public interface A extends B<T> { public T getObject(); } But now I can't extend A while telling it what type T is. I am completely confused. Anyone know why this is happening?

Refresh