• Home
  • Documentation
  • Forum
  • Blog
  • Users
    • Map
    • Userlist
    • Businesses
    • Userpages
    • Connections
  • Contributions
    • All
    • Store
  • Downloads
    • vvvv beta
    • vvvv beta previews
  • Store
Show / Hide Table of Contents

VL Dynamic instancing without Delegates

Author: domj
Date: 18 Jan, 2019
Category: demo

Download

32bit

0-VVVV.Value_.DynamicInstancingViaName.zip
18 Jan, 2019 - 22:50

The demo patch

Description

Hi!

I was wondering how to instance an arbitrary object based on its type name in VL for a while.

For now I offer this solution that uses the built-in Deserialize functionality, inspired by the arbitrary object spread demo in the VL Serialization help patch.

Although not perfect (any object you expect to instance has to be explicitly used in the patch (inspired by elias's LINK experience)), it's the closest solution I know of until this functionality gets native support. Is it better than Delegates with a Dictionary? You decide!

Any simplification tips appreciated.

Until next time!

Comments

Comments are no longer accepted.
Please create a new topic in the vvvv beta forum to discuss this contribution.
Elias
21 Jan, 2019 - 15:12

Hey Dominik, nice to put this out there. I'll report back once I get to VL and dynamic instantiation again.

microdee
22 Jan, 2019 - 10:26

Is there a limitation of why Activator.CreateInstance wouldn't work in vl? at least it should work in script region https://docs.microsoft.com/en-us/dotnet/api/system.activator.createinstance?view=netframework-4.7.2

also for more reflection goodies check out fasterflect https://github.com/buunguyen/fasterflect ;)

Elias
23 Jan, 2019 - 10:31

CteateInstance should also work but maybe little tricky to know what values to feed for the arguments. Would be easier if a default ctor would be present in target code.

  • Improve this Doc

© 2020 by vvvv group. Imprint | Privacy Policy.
Thanks to DocFX for building this website. Analytics by Plausible.

Back to top