Last post Aug 02, 2020 03:47 PM by fazioliamboina
Member
5 Points
159 Posts
Aug 01, 2020 10:39 PM|fazioliamboina|LINK
i want a function to return an object casted to the type that a caller specifies
Definition
public T GetCache<T>() { return (T)Convert.ChangeType(CachedModel, typeof(T)); }
Usage (as you see, it does not get casted, because it does not have any property suggestions)
Aug 02, 2020 03:47 PM|fazioliamboina|LINK
public T Foo<T>() { return (T)anotherFoo; }
Member
5 Points
159 Posts
C# function | return an objected with its type, so i dont have to cast it.
Aug 01, 2020 10:39 PM|fazioliamboina|LINK
i want a function to return an object casted to the type that a caller specifies
Definition
Usage (as you see, it does not get casted, because it does not have any property suggestions)
Member
5 Points
159 Posts
Re: C# function | return an objected with its type, so i dont have to cast it.
Aug 02, 2020 03:47 PM|fazioliamboina|LINK