﻿<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title> Reading integer from console </Title>
            <Description> Expansion snippet for reading integer value from console. </Description>
            <Author>Microsoft Corporation</Author>
            <SnippetTypes>          
                <SnippetType> Expansion </SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID> Number</ID>
                    <Default> nInt </Default>
                    <ToolTip> Variable to hold integer value read from console. </ToolTip>
                </Literal>
            </Declarations>
            <Code Language="vjsharp" Format="CData"><![CDATA[int $Number$ = 0; //variable to store the integer value read from console
try
{
    java.io.BufferedReader objBuffReader = new java.io.BufferedReader(
                                        new java.io.InputStreamReader(
                                        java.lang.System.in));
    String strLine = objBuffReader.readLine();
    $Number$ = Integer.parseInt(strLine);
}
catch (java.io.IOException e)
{
System.out.println("Error: Invalid IO operation.");
}
catch (java.lang.NumberFormatException e)
{
System.out.println("Error: Invalid number format.");
}
$selected$ $end$
]]>
</Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>
