Argument

We found 10 examples in language CSharp for this search. You will see 45 fragments of code.
		[TearDown]
		public void TearDown () {}

		[SetUp]
		public void SetUp () {}

		[Test]
		public void TestActiveBorder ()
		{
			SolidBrush brush;
			brush = (SolidBrush) SystemBrushes.ActiveBorder;
			Assert.IsTrue (brush.Color.IsSystemColor, "P1#1");
			Assert.AreEqual (SystemColors.ActiveBorder, brush.Color, "P1#2");

			try {
				brush.Color = Color.Red;
				Assert.Fail ("P1#3: must throw ArgumentException");
			} catch (ArgumentException) {
				Assert.IsTrue (true, "P1#3");
			}

			try {
				brush.Color = SystemColors.ActiveBorder;
				Assert.Fail ("P1#4: must throw ArgumentException");
			} catch (ArgumentException) {
				Assert.IsTrue (true, "P1#4");
			}

			try {
				brush.Dispose();
				Assert.Fail ("P1#5: must throw ArgumentException");
			} catch (ArgumentException) {
				Assert.IsTrue (true, "P1#5");
			}
		}

		[Test]
		public void TestActiveCaption ()
		{
			SolidBrush brush;
			brush = (SolidBrush) SystemBrushes.ActiveCaption;
			Assert.IsTrue (brush.Color.IsSystemColor, "P2#1");
			Assert.AreEqual (SystemColors.ActiveCaption, brush.Color, "P2#2");

			try {
				brush.Color = Color.Red;
				Assert.Fail ("P2#3: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P2#3");
			}

			try {
				brush.Color = SystemColors.ActiveCaption;
				Assert.Fail ("P2#4: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P2#4");
			}

			try {
				brush.Dispose();
				Assert.Fail ("P2#5: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P2#5");
			}

		}

		[Test]
		public void TestActiveCaptionText ()
		{
			SolidBrush brush;
			brush = (SolidBrush) SystemBrushes.ActiveCaptionText;
			Assert.IsTrue (brush.Color.IsSystemColor, "P3#1");
			Assert.AreEqual (SystemColors.ActiveCaptionText, brush.Color, "P3#2");

			try {
				brush.Color = Color.Red;
				Assert.Fail ("P3#3: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P3#3");
			}

			try {
				brush.Color = SystemColors.ActiveCaptionText;
				Assert.Fail ("P3#4: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P3#4");
			}

			try {
				brush.Dispose();
				Assert.Fail ("P3#5: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P3#5");
			}
		}

		[Test]
		public void TestAppWorkspace ()
		{
			SolidBrush brush;
			brush = (SolidBrush) SystemBrushes.AppWorkspace;
			Assert.IsTrue (brush.Color.IsSystemColor, "P4#1");
			Assert.AreEqual (SystemColors.AppWorkspace, brush.Color, "P4#2");

			try {
				brush.Color = Color.Red;
				Assert.Fail ("P4#3: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P4#3");
			}

			try {
				brush.Color = SystemColors.AppWorkspace;
				Assert.Fail ("P4#4: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P4#4");
			}

			try {
				brush.Dispose();
				Assert.Fail ("P4#5: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P4#5");
			}
		}

using DG.Tools;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Metadata;
using Microsoft.Xrm.Sdk.Query;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Reflection;
using System.ServiceModel;
using System.Text.RegularExpressions;

namespace DG.Tools.XrmMockup.Metadata
{
    internal static class Arguments {

        public static ArgumentDescription Url = new ArgumentDescription() {
            Name = "url",
            Abbreviations = new string[] { }
        };

        public static ArgumentDescription Username = new ArgumentDescription() {
            Name = "username",
            Abbreviations = new string[] { "usr", "u" }
        };

        public static ArgumentDescription Password = new ArgumentDescription() {
            Name = "password",
            Abbreviations = new string[] { "pwd", "p" }
        };

        public static ArgumentDescription Domain = new ArgumentDescription() {
            Name = "domain",
            Abbreviations = new string[] { "dmn", "d" }
        };

        public static ArgumentDescription AuthProvider = new ArgumentDescription() {
            Name = "ap",
            Abbreviations = new string[] { "authenticationprovider", "provider" }
        };

        public static ArgumentDescription OutDir = new ArgumentDescription() {
            Name = "outDir",
            Abbreviations = new string[] { "out", "o" }
        };


        public static ArgumentDescription Entities = new ArgumentDescription() {
            Name = "entities",
            Abbreviations = new string[] { "es" }
        };

        public static ArgumentDescription Solutions = new ArgumentDescription() {
            Name = "solutions",
            Abbreviations = new string[] { "ss" }
        };

        public static ArgumentDescription UnitTestProjectPath = new ArgumentDescription() {
            Name = "projectPath",
            Abbreviations = new string[] { "pp" }
        };

        public static ArgumentDescription fetchFromAssemblies = new ArgumentDescription()
        {
            Name = "fetchFromAssemblies",
            Abbreviations = new string[] { "fa" }
        };

        public static ArgumentDescription Method = new ArgumentDescription()
        {
            Name = "method",
            Abbreviations = new string[] { }
        };

        public static ArgumentDescription ClientId = new ArgumentDescription()
        {
            Name = "mfaAppId",
            Abbreviations = new string[] { }
        };

        public static ArgumentDescription ReturnUrl = new ArgumentDescription()
        {
            Name = "mfaReturnUrl",
            Abbreviations = new string[] { }
        };

        public static ArgumentDescription ClientSecret = new ArgumentDescription()
        {
            Name = "mfaClientSecret",
            Abbreviations = new string[] { }
        };

        public static ArgumentDescription ConnectionString = new ArgumentDescription()
        {
            Name = "connectionString",
            Abbreviations = new string[] { }
        };

        public static ArgumentDescription[] ArgList = new ArgumentDescription[] {
            Url,
            Username,
            Password,
            Domain,
            AuthProvider,
            Entities,
            Solutions,
            OutDir,
            UnitTestProjectPath,
            fetchFromAssemblies,
            Method,
            ClientId,
            ReturnUrl,
            ClientSecret,
            ConnectionString
        };
    }
}


		//

		private void ParseSpecialArguments(Type[] argumentTypes, ArgumentType[] argumentVariations)
		{
			if (argumentVariations == null || argumentVariations.Length == 0)
			{
				info.argumentTypes = argumentTypes;
				return;
			}

			if (argumentTypes.Length < argumentVariations.Length)
				throw new ArgumentException("argumentVariations contains more elements than argumentTypes", nameof(argumentVariations));

			var types = new List<Type>();
			for (var i = 0; i < argumentTypes.Length; i++)
			{
				var type = argumentTypes[i];
				switch (argumentVariations[i])
				{
					case ArgumentType.Ref:
					case ArgumentType.Out:
						type = type.MakeByRefType();
						break;
					case ArgumentType.Pointer:
						type = type.MakePointerType();
						break;
				}
				types.Add(type);
			}
			info.argumentTypes = types.ToArray();
		}

		[TearDown]
		public void TearDown () {}

		[SetUp]
		public void SetUp () {}

		[Test]
		public void TestActiveBorder ()
		{
			SolidBrush brush;
			brush = (SolidBrush) SystemBrushes.ActiveBorder;
			Assert.IsTrue (brush.Color.IsSystemColor, "P1#1");
			Assert.AreEqual (SystemColors.ActiveBorder, brush.Color, "P1#2");

			try {
				brush.Color = Color.Red;
				Assert.Fail ("P1#3: must throw ArgumentException");
			} catch (ArgumentException) {
				Assert.IsTrue (true, "P1#3");
			}

			try {
				brush.Color = SystemColors.ActiveBorder;
				Assert.Fail ("P1#4: must throw ArgumentException");
			} catch (ArgumentException) {
				Assert.IsTrue (true, "P1#4");
			}

			try {
				brush.Dispose();
				Assert.Fail ("P1#5: must throw ArgumentException");
			} catch (ArgumentException) {
				Assert.IsTrue (true, "P1#5");
			}
		}

		[Test]
		public void TestActiveCaption ()
		{
			SolidBrush brush;
			brush = (SolidBrush) SystemBrushes.ActiveCaption;
			Assert.IsTrue (brush.Color.IsSystemColor, "P2#1");
			Assert.AreEqual (SystemColors.ActiveCaption, brush.Color, "P2#2");

			try {
				brush.Color = Color.Red;
				Assert.Fail ("P2#3: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P2#3");
			}

			try {
				brush.Color = SystemColors.ActiveCaption;
				Assert.Fail ("P2#4: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P2#4");
			}

			try {
				brush.Dispose();
				Assert.Fail ("P2#5: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P2#5");
			}

		}

		[Test]
		public void TestActiveCaptionText ()
		{
			SolidBrush brush;
			brush = (SolidBrush) SystemBrushes.ActiveCaptionText;
			Assert.IsTrue (brush.Color.IsSystemColor, "P3#1");
			Assert.AreEqual (SystemColors.ActiveCaptionText, brush.Color, "P3#2");

			try {
				brush.Color = Color.Red;
				Assert.Fail ("P3#3: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P3#3");
			}

			try {
				brush.Color = SystemColors.ActiveCaptionText;
				Assert.Fail ("P3#4: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P3#4");
			}

			try {
				brush.Dispose();
				Assert.Fail ("P3#5: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P3#5");
			}
		}

		[Test]
		public void TestAppWorkspace ()
		{
			SolidBrush brush;
			brush = (SolidBrush) SystemBrushes.AppWorkspace;
			Assert.IsTrue (brush.Color.IsSystemColor, "P4#1");
			Assert.AreEqual (SystemColors.AppWorkspace, brush.Color, "P4#2");

			try {
				brush.Color = Color.Red;
				Assert.Fail ("P4#3: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P4#3");
			}

			try {
				brush.Color = SystemColors.AppWorkspace;
				Assert.Fail ("P4#4: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P4#4");
			}

			try {
				brush.Dispose();
				Assert.Fail ("P4#5: must throw ArgumentException");
			} catch (Exception e) {
				Assert.IsTrue (e is ArgumentException, "P4#5");
			}
		}

		[Test]
		public void FaultNullTest()
		{
			foreach (var block in Blocks.CreateBlocks ()) {
				AssertEx.Throws<ArgumentNullException> (() => block.Fault (null));
			}
		}

		[Test]
		public void  ActionBlockTest ()
		{
			AssertEx.Throws<ArgumentNullException> (
				() => new ActionBlock<int> ((Action<int>)null));
			AssertEx.Throws<ArgumentNullException> (
				() => new ActionBlock<int> (i => { }, null));
		}

		[Test]
		public void BatchBlockTest()
		{
			AssertEx.Throws<ArgumentOutOfRangeException> (() => new BatchBlock<int> (0));
			AssertEx.Throws<ArgumentOutOfRangeException> (() => new BatchBlock<int> (-1));

			AssertEx.Throws<ArgumentOutOfRangeException> (
				() => new BatchBlock<int> (2,
					      new GroupingDataflowBlockOptions { BoundedCapacity = 1 }));

			AssertEx.Throws<ArgumentNullException> (() => new BatchBlock<int> (2, null));
		}

		[Test]
		public void BatchedJoinBlockTest()
		{
			AssertEx.Throws<ArgumentOutOfRangeException> (() => new BatchedJoinBlock<int, int> (0));
			AssertEx.Throws<ArgumentOutOfRangeException> (() => new BatchedJoinBlock<int, int> (-1));

			AssertEx.Throws<ArgumentException> (
				() => new BatchedJoinBlock<int, int> (1,
					      new GroupingDataflowBlockOptions { BoundedCapacity = 1 }));
			AssertEx.Throws<ArgumentException> (
				() => new BatchedJoinBlock<int, int> (1,
					      new GroupingDataflowBlockOptions { Greedy = false }));

			AssertEx.Throws<ArgumentNullException> (() => new BatchedJoinBlock<int, int> (2, null));
		}

		[Test]
		public void BatchedJoinBlock3Test()
		{
			AssertEx.Throws<ArgumentOutOfRangeException> (() => new BatchedJoinBlock<int, int, int> (0));
			AssertEx.Throws<ArgumentOutOfRangeException> (() => new BatchedJoinBlock<int, int, int> (-1));

			AssertEx.Throws<ArgumentException> (
				() => new BatchedJoinBlock<int, int, int> (1,
					      new GroupingDataflowBlockOptions { BoundedCapacity = 1 }));
			AssertEx.Throws<ArgumentException> (
				() => new BatchedJoinBlock<int, int, int> (1,
					      new GroupingDataflowBlockOptions { Greedy = false }));

			AssertEx.Throws<ArgumentNullException> (() => new BatchedJoinBlock<int, int, int> (2, null));
		}

		[Test]
		public void BroadcastBlock()
		{
			// null is valid argument for BroadcastBlock, so this shouldn't throw
			new BroadcastBlock<int> (null);
			AssertEx.Throws<ArgumentNullException> (() => new BroadcastBlock<int> (i => i, null));
		}


        /// <summary>
        /// Parses the supplied arguments. Logs errors for unrecognized, duplicate or missing arguments.
        /// </summary>
        /// <param name="argumentInstances">A list of argument instances that have been recognized</param>
        public bool ParseArguments(string[] commandLineArgs, ILogger logger, out IEnumerable<ArgumentInstance> argumentInstances)
        {
            if (commandLineArgs == null)
            {
                throw new ArgumentNullException(nameof(commandLineArgs));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            var parsedOk = true;

            // List of values that have been recognized
            IList<ArgumentInstance> recognized = new List<ArgumentInstance>();

            foreach (var arg in commandLineArgs)
            {
                if (TryGetMatchingDescriptor(arg, out var descriptor, out var prefix))
                {
                    var newId = descriptor.Id;

                    if (!descriptor.AllowMultiple && IdExists(newId, recognized))
                    {
                        ArgumentInstance.TryGetArgumentValue(newId, recognized, out var existingValue);
                        logger.LogError(Resources.ERROR_CmdLine_DuplicateArg, arg, existingValue);
                        parsedOk = false;
                    }
                    else
                    {
                        // Store the argument
                        var argValue = arg.Substring(prefix.Length);
                        recognized.Add(new ArgumentInstance(descriptor, argValue));
                    }
                }
                else
                {
                    if (!allowUnrecognized)
                    {
                        logger.LogError(Resources.ERROR_CmdLine_UnrecognizedArg, arg);
                        parsedOk = false;
                    }

                    Debug.WriteLineIf(allowUnrecognized, "Ignoring unrecognized argument: " + arg);
                }
            }

            // We'll check for missing arguments this even if the parsing failed so we output as much detail
            // as possible about the failures.
            parsedOk &= CheckRequiredArgumentsSupplied(recognized, logger);

            argumentInstances = parsedOk ? recognized : Enumerable.Empty<ArgumentInstance>();

            return parsedOk;
        }

        /// <summary>
        /// Attempts to find a descriptor for the current argument
        /// </summary>
        /// <param name="argument">The argument passed on the command line</param>
        /// <param name="descriptor">The descriptor that matches the argument</param>
        /// <param name="prefix">The specific prefix that was matched</param>
        private bool TryGetMatchingDescriptor(string argument, out ArgumentDescriptor descriptor, out string prefix)
        {
            descriptor = null;
            prefix = null;

            var found = false;

            foreach (var item in descriptors)
            {
                var match = TryGetMatchingPrefix(item, argument);
                if (match != null)
                {
                    descriptor = item;
                    prefix = match;
                    found = true;
                    break;
                }
            }
            return found;
        }

        private static string TryGetMatchingPrefix(ArgumentDescriptor descriptor, string argument)
        {
            Debug.Assert(descriptor.Prefixes.Count(p => argument.StartsWith(p, ArgumentDescriptor.IdComparison)) < 2,
                "Not expecting the argument to match multiple prefixes");

            string match;
            if (descriptor.IsVerb)
            {
                // Verbs match the whole argument
                match = descriptor.Prefixes.FirstOrDefault(p => ArgumentDescriptor.IdComparer.Equals(p, argument));
            }
            else
            {
                // Prefixes only match the start
                match = descriptor.Prefixes.FirstOrDefault(p => argument.StartsWith(p, ArgumentDescriptor.IdComparison));
            }
            return match;
        }

        private static bool IdExists(string id, IEnumerable<ArgumentInstance> arguments)
        {
            var exists = ArgumentInstance.TryGetArgument(id, arguments, out var existing);
            return exists;
        }

        /// <summary>
        /// Checks whether any required arguments are missing and logs error messages for them.
        /// </summary>
        private bool CheckRequiredArgumentsSupplied(IEnumerable<ArgumentInstance> arguments, ILogger logger)
        {
            var allExist = true;
            foreach (var desc in descriptors.Where(d => d.Required))
            {
                ArgumentInstance.TryGetArgument(desc.Id, arguments, out var argument);

                var exists = argument != null && !string.IsNullOrWhiteSpace(argument.Value);
                if (!exists)
                {
                    logger.LogError(Resources.ERROR_CmdLine_MissingRequiredArgument, desc.Description);
                    allExist = false;
                }
            }
            return allExist;
        }


		public override string ToString ()
		{
			string val = value != null ? value.ToString () : String.Empty;
			if (argumentType == typeof (string))
				return "\"" + val + "\"";
			if (argumentType == typeof (Type)) 
				return "typeof (" + val + ")";
			if (argumentType.IsEnum)
				return "(" + argumentType.Name + ")" + val;

			return val;
		}

		public override bool Equals (object obj)
		{
			if (!(obj is CustomAttributeTypedArgument))
				return false;
			CustomAttributeTypedArgument other = (CustomAttributeTypedArgument) obj;
			return  other.argumentType == argumentType &&
				value != null ? value.Equals (other.value) : (object) other.value == null;
		}

		public override int GetHashCode ()
		{
			return (argumentType.GetHashCode () << 16) + (value != null ? value.GetHashCode () : 0);
		}

		[SetUp]
		public void SetUp () { }

		[TearDown]
		public void TearDown () { }
		
		[Test]
		public void TestEquals ()
		{
			Pen pen1 = Pens.Blue;
			Pen pen2 = Pens.Blue;
			
			Assert.AreEqual (true, pen1.Equals (pen2),  "Equals");
		}

		[Test]
		public void TestAliceBlue ()
		{
			Pen pen = Pens.AliceBlue;
			Assert.AreEqual (pen.PenType, PenType.SolidColor, "P1#1");
			Assert.AreEqual (pen.Color, Color.AliceBlue, "P1#2");

			try {
				pen.Color = Color.AliceBlue;
				Assert.Fail ("P1#3: must throw ArgumentException");
			} catch (ArgumentException) {
				Assert.IsTrue (true, "P1#3");
			}
		}

		[Test]
		public void TestAntiqueWhite ()
		{
			Pen pen = Pens.AntiqueWhite;
			Assert.AreEqual (pen.PenType, PenType.SolidColor, "P2#1");
			Assert.AreEqual (pen.Color, Color.AntiqueWhite, "P2#2");

			try {
				pen.Color = Color.AntiqueWhite;
				Assert.Fail ("P2#3: must throw ArgumentException");
			} catch (ArgumentException) {
				Assert.IsTrue (true, "P2#3");
			}
		}

		[Test]
		public void TestAqua ()
		{
			Pen pen = Pens.Aqua;
			Assert.AreEqual (pen.PenType, PenType.SolidColor, "P3#1");
			Assert.AreEqual (pen.Color, Color.Aqua, "P3#2");

			try {
				pen.Color = Color.Aqua;
				Assert.Fail ("P3#3: must throw ArgumentException");
			} catch (ArgumentException) {
				Assert.IsTrue (true, "P3#3");
			}
		}

        [TestMethod]
        public void Ctor_WhenDescriptorIsNull_ThrowsArgumentNullException()
        {
            // Arrange
            Action action = () => new ArgumentInstance(null, "foo");

            // Assert
            action.Should().ThrowExactly<ArgumentNullException>().And.ParamName.Should().Be("descriptor");
        }

        [TestMethod]
        public void TryGetArgument_WhenIdIsNull_ThrowsArgumentNullException()
        {
            // Arrange
            Action action = () => ArgumentInstance.TryGetArgument(null, Enumerable.Empty<ArgumentInstance>(), out var instance);

            // Assert
            action.Should().ThrowExactly<ArgumentNullException>().And.ParamName.Should().Be("id");
        }

        [TestMethod]
        public void TryGetArgument_WhenIdIsEmpty_ThrowsArgumentNullException()
        {
            // Arrange
            Action action = () => ArgumentInstance.TryGetArgument("", Enumerable.Empty<ArgumentInstance>(), out var instance);

            // Assert
            action.Should().ThrowExactly<ArgumentNullException>().And.ParamName.Should().Be("id");
        }

        [TestMethod]
        public void TryGetArgument_WhenIdIsWhitespaces_ThrowsArgumentNullException()
        {
            // Arrange
            Action action = () => ArgumentInstance.TryGetArgument("   ", Enumerable.Empty<ArgumentInstance>(), out var instance);

            // Assert
            action.Should().ThrowExactly<ArgumentNullException>().And.ParamName.Should().Be("id");
        }

        [TestMethod]
        public void TryGetArgument_WhenArgumentsIsNull_ThrowsArgumentNullException()
        {
            // Arrange
            Action action = () => ArgumentInstance.TryGetArgument("foo", null, out var instance);

            // Assert
            action.Should().ThrowExactly<ArgumentNullException>().And.ParamName.Should().Be("arguments");
        }

        /// <summary>
        /// Computes the dot product of x and y.
        /// </summary>
        /// <param name="x">The vector x.</param>
        /// <param name="y">The vector y.</param>
        /// <returns>The dot product of x and y.</returns>
        /// <remarks>This is equivalent to the DOT BLAS routine.</remarks>
        [SecuritySafeCritical]
        public override Complex DotProduct(Complex[] x, Complex[] y)
        {
            if (y == null)
            {
                throw new ArgumentNullException("y");
            }

            if (x == null)
            {
                throw new ArgumentNullException("x");
            }

            if (x.Length != y.Length)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength);
            }

            return SafeNativeMethods.z_dot_product(x.Length, x, y);
        }
        
        /// <summary>
        /// Adds a scaled vector to another: <c>result = y + alpha*x</c>.
        /// </summary>
        /// <param name="y">The vector to update.</param>
        /// <param name="alpha">The value to scale <paramref name="x"/> by.</param>
        /// <param name="x">The vector to add to <paramref name="y"/>.</param>
        /// <param name="result">The result of the addition.</param>
        /// <remarks>This is similar to the AXPY BLAS routine.</remarks>
        [SecuritySafeCritical]
        public override void AddVectorToScaledVector(Complex[] y, Complex alpha, Complex[] x, Complex[] result)
        {
            if (y == null)
            {
                throw new ArgumentNullException("y");
            }

            if (x == null)
            {
                throw new ArgumentNullException("x");
            }

            if (y.Length != x.Length)
            {
                throw new ArgumentException(Resources.ArgumentVectorsSameLength);
            }

            if (!ReferenceEquals(y, result))
            {
                Array.Copy(y, 0, result, 0, y.Length);
            }

            if (alpha == Complex.Zero)
            {
                return;
            }

            SafeNativeMethods.z_axpy(y.Length, alpha, x, result);
        }

        /// <summary>
        /// Scales an array. Can be used to scale a vector and a matrix.
        /// </summary>
        /// <param name="alpha">The scalar.</param>
        /// <param name="x">The values to scale.</param>
        /// <param name="result">This result of the scaling.</param>
        /// <remarks>This is similar to the SCAL BLAS routine.</remarks>
        [SecuritySafeCritical]
        public override void ScaleArray(Complex alpha, Complex[] x, Complex[] result)
        {
            if (x == null)
            {
                throw new ArgumentNullException("x");
            } 
            
            if (!ReferenceEquals(x, result))
            {
                Array.Copy(x, 0, result, 0, x.Length);
            }

            if (alpha == Complex.One)
            {
                return;
            }

            SafeNativeMethods.z_scale(x.Length, alpha, result);
        }

        /// <summary>
        /// Multiples two matrices. <c>result = x * y</c>
        /// </summary>
        /// <param name="x">The x matrix.</param>
        /// <param name="rowsX">The number of rows in the x matrix.</param>
        /// <param name="columnsX">The number of columns in the x matrix.</param>
        /// <param name="y">The y matrix.</param>
        /// <param name="rowsY">The number of rows in the y matrix.</param>
        /// <param name="columnsY">The number of columns in the y matrix.</param>
        /// <param name="result">Where to store the result of the multiplication.</param>
        /// <remarks>This is a simplified version of the BLAS GEMM routine with alpha
        /// set to Complex.One and beta set to Complex.Zero, and x and y are not transposed.</remarks>
        public override void MatrixMultiply(Complex[] x, int rowsX, int columnsX, Complex[] y, int rowsY, int columnsY, Complex[] result)
        {
            MatrixMultiplyWithUpdate(Transpose.DontTranspose, Transpose.DontTranspose, Complex.One, x, rowsX, columnsX, y, rowsY, columnsY, Complex.Zero, result);
        }

        /// <summary>
        /// Multiplies two matrices and updates another with the result. <c>c = alpha*op(a)*op(b) + beta*c</c>
        /// </summary>
        /// <param name="transposeA">How to transpose the <paramref name="a"/> matrix.</param>
        /// <param name="transposeB">How to transpose the <paramref name="b"/> matrix.</param>
        /// <param name="alpha">The value to scale <paramref name="a"/> matrix.</param>
        /// <param name="a">The a matrix.</param>
        /// <param name="rowsA">The number of rows in the <paramref name="a"/> matrix.</param>
        /// <param name="columnsA">The number of columns in the <paramref name="a"/> matrix.</param>
        /// <param name="b">The b matrix</param>
        /// <param name="rowsB">The number of rows in the <paramref name="b"/> matrix.</param>
        /// <param name="columnsB">The number of columns in the <paramref name="b"/> matrix.</param>
        /// <param name="beta">The value to scale the <paramref name="c"/> matrix.</param>
        /// <param name="c">The c matrix.</param>
        [SecuritySafeCritical]
        public override void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, Complex alpha, Complex[] a, int rowsA, int columnsA, Complex[] b, int rowsB, int columnsB, Complex beta, Complex[] c)
        {
            if (a == null)
            {
                throw new ArgumentNullException("a");
            }

            if (b == null)
            {
                throw new ArgumentNullException("b");
            }

            if (c == null)
            {
                throw new ArgumentNullException("c");
            }

            var m = transposeA == Transpose.DontTranspose ? rowsA : columnsA;
            var n = transposeB == Transpose.DontTranspose ? columnsB : rowsB;
            var k = transposeA == Transpose.DontTranspose ? columnsA : rowsA;
            var l = transposeB == Transpose.DontTranspose ? rowsB : columnsB;

            if (c.Length != m * n)
            {
                throw new ArgumentException(Resources.ArgumentMatrixDimensions);   
            }

            if (k != l)
            {
                throw new ArgumentException(Resources.ArgumentMatrixDimensions);
            }

            SafeNativeMethods.z_matrix_multiply(transposeA, transposeB, m, n, k, alpha, a, b, beta, c);
        }

        /// <summary>
        /// Computes the LUP factorization of A. P*A = L*U.
        /// </summary>
        /// <param name="data">An <paramref name="order"/> by <paramref name="order"/> matrix. The matrix is overwritten with the
        /// the LU factorization on exit. The lower triangular factor L is stored in under the diagonal of <paramref name="data"/> (the diagonal is always Complex.One
        /// for the L factor). The upper triangular factor U is stored on and above the diagonal of <paramref name="data"/>.</param>
        /// <param name="order">The order of the square matrix <paramref name="data"/>.</param>
        /// <param name="ipiv">On exit, it contains the pivot indices. The size of the array must be <paramref name="order"/>.</param>
        /// <remarks>This is equivalent to the GETRF LAPACK routine.</remarks>
        [SecuritySafeCritical]
        public override void LUFactor(Complex[] data, int order, int[] ipiv)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            if (ipiv == null)
            {
                throw new ArgumentNullException("ipiv");
            }

            if (data.Length != order * order)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "data");
            }

            if (ipiv.Length != order)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv");
            }
            
            SafeNativeMethods.z_lu_factor(order, data, ipiv);
        }

Google.Apis.Bigquery.v2.Data.Argument : IDirectResponseSchema

Constructors :

public Argument()

Methods :

public String get_ArgumentKind()
public Void set_ArgumentKind(String value = )
public StandardSqlDataType get_DataType()
public Void set_DataType(StandardSqlDataType value = )
public String get_Mode()
public Void set_Mode(String value = )
public String get_Name()
public Void set_Name(String value = )
public String get_ETag()
public Void set_ETag(String value = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()

Other methods