Example of using string instead of typeof
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
using System.Numerics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization;
|
||||
namespace Vector3VisualizerSource;
|
||||
|
||||
[DataContract]
|
||||
public class Vector3Model
|
||||
{
|
||||
[DataMember]
|
||||
public string Vector3 { get; set; } = string.Empty;
|
||||
public string Vector3 { get; set; } = "Null";
|
||||
[DataMember]
|
||||
public string Quaternion { get; set; } = string.Empty;
|
||||
public string Quaternion { get; set; } = "Null";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,30 @@
|
||||
using Microsoft.VisualStudio.DebuggerVisualizers;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Vector3VisualizerSource;
|
||||
|
||||
public class Vector3ObjectSource : VisualizerObjectSource
|
||||
{
|
||||
Vector3Model vector3Model = new();
|
||||
public Vector3ObjectSource():base()
|
||||
{
|
||||
Debug.WriteLine("new Vector3ObjectSource");
|
||||
}
|
||||
public override void GetData(object target, Stream outgoingData)
|
||||
{
|
||||
Vector3Model vector3Model = new();
|
||||
if (target is Vector3 vector3)
|
||||
{
|
||||
vector3Model.Vector3 = vector3.ToString();
|
||||
}
|
||||
if (target is IEnumerable<Vector3> vector3List)
|
||||
{
|
||||
vector3Model.Vector3 = vector3List.Last().ToString();
|
||||
}
|
||||
|
||||
if (target is Quaternion quaternion)
|
||||
{
|
||||
vector3Model.Quaternion = quaternion.ToString();
|
||||
|
||||
Reference in New Issue
Block a user