(One intermediate revision by the same user not shown)
Line 2:
Line 2:
<translate>
<translate>
<!--T:1-->
<!--T:1-->
{{stub}}
{{Infobox Component
{{Infobox Component
|Image=ReferenceCast`2Component.png
|Image=ReferenceCast`2Component.png
|Name=Reference Cast`2
|Name=Reference Cast`2
}}
}}
The '''ReferenceCast''' component can be used to try to take a type and change it to another type. This performs a C# cast which requires the types to be compatible for casting to make a result.
<!--T:2-->
<!--T:2-->
== Fields ==
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|Source|'''I'''|TypeAdv0=true|
|Source|'''I'''|TypeAdv0=true| The source type to convert
|Target|{{RootFieldType|RefDrive`1|O}}|TypeAdv1=true| The target field. Casts <code>Source</code> to this fields type, and then uses the result to drive this field.
|WriteBack|Bool|
|WriteBack|Bool| whether to allow changes to the <code>Target</code> to update <code>Source</code> instead of discarding the change. See [[Drives#Write Backs|write backs]].
}}
}}
<!--T:3-->
<!--T:3-->
== Usage ==
== Usage ==
This is a way of changing a type without using [[ProtoFlux]]. Attaching this component can be difficult, so you should be familiar with [[Complex Types in Components]]. Keep in mind this does a C# Cast, which does not work with many different conversions.
The ReferenceCast component can be used to try to take a type and change it to another type. This performs a C# cast which requires the types to be compatible for casting to make a result.
whether to allow changes to the Target to update Source instead of discarding the change. See write backs.
Usage
This is a way of changing a type without using ProtoFlux. Attaching this component can be difficult, so you should be familiar with Complex Types in Components. Keep in mind this does a C# Cast, which does not work with many different conversions.