﻿<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title> Copying source array into target array </Title>
            <Description> Expansion snippet for copying source array into target array. </Description>
            <Author>Microsoft Corporation</Author>
            <SnippetTypes>          
                <SnippetType> Expansion </SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID> SourceArray </ID>
                    <Default > sourceArray </Default>
                    <ToolTip> Source array containing elements to be copied to target array. </ToolTip>
                </Literal>
                <Literal>
                    <ID> TargetArray </ID>
                    <Default > targetArray </Default>
                    <ToolTip> Target array to which source array elements are to be copied. </ToolTip>
                </Literal>
            </Declarations>
            <Code Language="vjsharp" Format="CData"><![CDATA[
if (null == $SourceArray$ || null == $TargetArray$)
{
	System.out.println("Either source array or target array is null.");
}
else if ($TargetArray$.length > 0 && $SourceArray$.length <= $TargetArray$.length)
{
	//copy each value from source array to target array
	for (int i = 0; i < $SourceArray$.length; i++)
	{
		$TargetArray$[i] = $SourceArray$[i];
	}
}
else
{
	System.out.println("The size of target array is either zero or smaller than the source array.");
}
$selected$ $end$
]]>
</Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>
