Let's take a scenario that we need to develop as dexterity script using a .net assembly/DLL program inside the Dexterity script itself.
We have to create the assembly/DLL which we need to use or else use from .net framework.
- In Visual Studio we have to create a class library project. Provide Name as you want in your project. In my case, i have given the name as MyAssembly.
-
Add a new class to the project. Make sure that the access modifier of that class is public.Also, define public properties you need to access from the Dexterity script. public class ExtraFields
{
public string Description {get;set;}
public List<Field> FieldList = new List<Field>();
}
public class Field
{
public string Id {get;set;}
public string Value {get;set;}
}
- Compile your project.
- In order to use this assembly program in your Dexterity script, you have to install that to Global Assembly Cache(GAC). Refer this to know How to Install an Assembly in the GAC
- Then you have to refer that to the dexterity libraries.
- Use that in the dexterity script. using MyAssembly;
using MyAssembly.ExtraFields;
using System.Collections.Generic;
local ExtraFields extraFieldsObject;
local Field fieldObject;
extraFieldsObject = new ExtraFields();
fieldObject = new Field();
extraFieldsObject.Description = Your Value;
fieldObject.Id = Your Value;
fieldObject.Value = Your Value;
extraFieldsObject.FieldList.Add(fieldObject);
//DO YOUR WORK BELOW
Add a new class to the project. Make sure that the access modifier of that class is public.Also, define public properties you need to access from the Dexterity script. public class ExtraFields
{
public string Description {get;set;}
public List<Field> FieldList = new List<Field>();
}
public class Field
{
public string Id {get;set;}
public string Value {get;set;}
}
using MyAssembly.ExtraFields;
using System.Collections.Generic;
local ExtraFields extraFieldsObject;
local Field fieldObject;
extraFieldsObject = new ExtraFields();
fieldObject = new Field();
extraFieldsObject.Description = Your Value;
fieldObject.Id = Your Value;
fieldObject.Value = Your Value;
extraFieldsObject.FieldList.Add(fieldObject);
//DO YOUR WORK BELOW
Compile and run the script.
Comments
Post a Comment