Mono.Cecil.Tests.Formatter.WriteOperand C# (CSharp) Method

WriteOperand() static private method

static private WriteOperand ( TextWriter writer, object operand ) : void
writer System.IO.TextWriter
operand object
return void
        static void WriteOperand(TextWriter writer, object operand)
        {
            if (null == operand) throw new ArgumentNullException ("operand");

            var target = operand as Instruction;
            if (null != target) {
                writer.Write (FormatLabel (target.Offset));
                return;
            }

            var targets = operand as Instruction [];
            if (null != targets) {
                WriteLabelList (writer, targets);
                return;
            }

            string s = operand as string;
            if (null != s) {
                writer.Write ("\"" + s + "\"");
                return;
            }

            var parameter = operand as ParameterDefinition;
            if (parameter != null) {
                writer.Write (ToInvariantCultureString (parameter.Sequence));
                return;
            }

            s = ToInvariantCultureString (operand);
            writer.Write (s);
        }