Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CustomArrayProgram/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
26 changes: 26 additions & 0 deletions CustomArrayProgram/ArrayUtility.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CustomArrayProgram
{
public static class ArrayUtility
{
public static void Resize(ref int[] array, int newSize)
{
int[] newArray = new int[newSize];
for(int i = 0; i < array.Length; i++)
{
newArray[i] = array[i];

}
array = newArray;



}
}

}
53 changes: 53 additions & 0 deletions CustomArrayProgram/CustomArrayProgram.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C1AA6D3D-70D9-4816-B6B3-24943D023276}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>CustomArrayProgram</RootNamespace>
<AssemblyName>CustomArrayProgram</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ArrayUtility.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
28 changes: 28 additions & 0 deletions CustomArrayProgram/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CustomArrayProgram
{
class Program
{
static void Main(string[] args)
{
int[] numbers = new int[2];
numbers[0] = 10;
numbers[1] = 20;
ArrayUtility.Resize(ref numbers, numbers.Length + 2);
numbers[2] = 30;
numbers[3] = 40;
ArrayUtility.Resize(ref numbers, numbers.Length + 2);
numbers[4] = 50;
numbers[5] = 60;
for (int i = 0; i < numbers.Length; i++)
{
Console.WriteLine(numbers[i]);
}
}
}
}
36 changes: 36 additions & 0 deletions CustomArrayProgram/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CustomArrayProgram")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomArrayProgram")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c1aa6d3d-70d9-4816-b6b3-24943d023276")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Binary file not shown.
6 changes: 6 additions & 0 deletions CustomArrayProgram/bin/Debug/CustomArrayProgram.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0032bee0ea6cf01346060d3351f973cb02cd6d22
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
C:\Users\srivatsa.mc\source\repos\CustomArrayProgram\CustomArrayProgram\bin\Debug\CustomArrayProgram.exe.config
C:\Users\srivatsa.mc\source\repos\CustomArrayProgram\CustomArrayProgram\bin\Debug\CustomArrayProgram.exe
C:\Users\srivatsa.mc\source\repos\CustomArrayProgram\CustomArrayProgram\bin\Debug\CustomArrayProgram.pdb
C:\Users\srivatsa.mc\source\repos\CustomArrayProgram\CustomArrayProgram\obj\Debug\CustomArrayProgram.csprojResolveAssemblyReference.cache
C:\Users\srivatsa.mc\source\repos\CustomArrayProgram\CustomArrayProgram\obj\Debug\CustomArrayProgram.csproj.CoreCompileInputs.cache
C:\Users\srivatsa.mc\source\repos\CustomArrayProgram\CustomArrayProgram\obj\Debug\CustomArrayProgram.exe
C:\Users\srivatsa.mc\source\repos\CustomArrayProgram\CustomArrayProgram\obj\Debug\CustomArrayProgram.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 3 additions & 2 deletions DynamicArray.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
public class DynamicNumberArray{

int[] buffer;
public DynamicArray(){ buffer=new int[5];
public DynamicArray(int initialSize){ buffer=new int[initialSize];}
public DynamicNumberArray(){ buffer=new int[5];
public DynamicNumberArray(int initialSize)
{ buffer=new int[initialSize];}

public void Set(int index,int value){

Expand Down