本文整理汇总了C#中System.Array类的典型用法代码示例。如果您正苦于以下问题:C# Array类的具体用法?C# Array怎么用?C# Array使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Array类属于System命名空间,在下文中一共展示了Array类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnConnection
public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
{
try
{
_application = Core.Default.CreateObjectFromComProxy(null, Application);
/*
* _application is stored as COMObject the common base type for all reference types in NetOffice
* because this addin is loaded in different office application.
*
* with the CreateObjectFromComProxy method the _application instance is created as corresponding wrapper based on the com proxy type
*/
if (_application is Excel.Application)
_hostApplicationName = "Excel";
else if (_application is Word.Application)
_hostApplicationName = "Word";
else if (_application is Outlook.Application)
_hostApplicationName = "Outlook";
else if (_application is PowerPoint.Application)
_hostApplicationName = "PowerPoint";
else if (_application is Access.Application)
_hostApplicationName = "Access";
}
catch (Exception exception)
{
if(_hostApplicationName != null)
OfficeRegistry.LogErrorMessage(_hostApplicationName, _progId, "Error occured in OnConnection. ", exception);
}
}
开发者ID:swatt6400,项目名称:NetOffice,代码行数:30,代码来源:Addin.cs
示例2: Method1
static void Method1(ref byte param1)
{
for (; m_bFlag; param1 = param1)
{
Array[] a = new Array[2];
}
}
开发者ID:CheneyWu,项目名称:coreclr,代码行数:7,代码来源:b56154.cs
示例3: Copy
private static void Copy(Array array, int dimension, Array jagged, params int[] indices)
{
if (dimension > 1)
CopyNextDimension(array, dimension, jagged, indices);
else
CopyLastDimension(array, jagged, indices);
}
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:7,代码来源:MultidimensionalArrayRelay.cs
示例4: GetDevicePtr
protected override DevicePtrEx GetDevicePtr(Array array, ref int n)
{
EmuDevicePtrEx ptrEx = new EmuDevicePtrEx(0, array, array.Length);
if (n == 0)
n = ptrEx.TotalSize;
return ptrEx;
}
开发者ID:constructor-igor,项目名称:cudafy,代码行数:7,代码来源:CudaHostRAND.cs
示例5: ThrowIfIsNullOrEmpty
public static void ThrowIfIsNullOrEmpty(Array array)
{
if (array == null || array.Length == 0)
{
throw new ArgumentNullException();
}
}
开发者ID:razaraz,项目名称:Pscx,代码行数:7,代码来源:PscxException.cs
示例6: BlockCopy
// Copy a block of bytes from one primitive array to another.
public static void BlockCopy(Array src, int srcOffset,
Array dst, int dstOffset,
int count)
{
int srcLen = ValidatePrimitive(src, "src");
int dstLen = ValidatePrimitive(dst, "dst");
if(srcOffset < 0)
{
throw new ArgumentOutOfRangeException
("srcOffset", _("ArgRange_Array"));
}
if(count < 0)
{
throw new ArgumentOutOfRangeException
("count", _("ArgRange_Array"));
}
if((srcLen - srcOffset) < count)
{
throw new ArgumentException
("count", _("ArgRange_Array"));
}
if(dstOffset < 0 )
{
throw new ArgumentOutOfRangeException
("dstOffset", _("ArgRange_Array"));
}
if((dstLen - dstOffset) < count)
{
throw new ArgumentException
("count", _("ArgRange_Array"));
}
Copy(src, srcOffset, dst, dstOffset, count);
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:34,代码来源:Buffer.cs
示例7: RenderArray
/// <summary>
/// Dump the contents of an array into a string builder
/// </summary>
static void RenderArray(Array array, StringBuilder buffer)
{
if (array == null)
buffer.Append(SystemInfo.NullText);
else
{
if (array.Rank != 1)
buffer.Append(array.ToString());
else
{
buffer.Append("{");
var len = array.Length;
if (len > 0)
{
RenderObject(array.GetValue(0), buffer);
for (var i = 1; i < len; i++)
{
buffer.Append(", ");
RenderObject(array.GetValue(i), buffer);
}
}
buffer.Append("}");
}
}
}
开发者ID:mateuscezar,项目名称:netgore,代码行数:29,代码来源:SystemStringFormat.cs
示例8: OnDisconnection
public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom)
{
//if (disconnectMode == ext_DisconnectMode.ext_dm_HostShutdown
// || disconnectMode == ext_DisconnectMode.ext_dm_UserClosed)
//{
// _gitPlugin.DeleteCommands();
// _gitPlugin.DeleteCommandBar(GitToolBarName);
// //Place the command on the tools menu.
// //Find the MenuBar command bar, which is the top-level command bar holding all the main menu items:
// var menuBarCommandBar = ((CommandBars)_applicationObject.CommandBars)["MenuBar"];
// CommandBarControl toolsControl;
// try
// {
// toolsControl = menuBarCommandBar.Controls["Git"];
// if (toolsControl != null)
// {
// toolsControl.Delete();
// }
// }
// catch
// {
// }
//}
}
开发者ID:robin521111,项目名称:gitextensions,代码行数:25,代码来源:Connect.cs
示例9: OnConnection
/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
/// <param term='application'>Root object of the host application.</param>
/// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
/// <param term='addInInst'>Object representing this Add-in.</param>
/// <seealso class='IDTExtensibility2' />
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
Globals.DTE = (DTE2)application;
Globals.Addin = (AddIn)addInInst;
solutionEvents = Globals.DTE.Events.SolutionEvents;
solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);
solutionEvents.BeforeClosing += new _dispSolutionEvents_BeforeClosingEventHandler(SolutionEvents_BeforeClosing);
commandManager = new CommandManager(Globals.DTE, Globals.Addin);
commandBarBuilder = new CommandBarBuilder(Globals.DTE, Globals.Addin);
switch (connectMode)
{
case ext_ConnectMode.ext_cm_UISetup:
// Initialize the UI of the add-in
break;
case ext_ConnectMode.ext_cm_Startup:
// The add-in was marked to load on startup
// Do nothing at this point because the IDE may not be fully initialized
// Visual Studio will call OnStartupComplete when fully initialized
break;
case ext_ConnectMode.ext_cm_AfterStartup:
// The add-in was loaded by hand after startup using the Add-In Manager
// Initialize it in the same way that when is loaded on startup
Initialize();
break;
}
}
开发者ID:ptomasroos,项目名称:ivyvisual,代码行数:36,代码来源:Connect.cs
示例10: CreateAll
public static void CreateAll(SPWeb web, Array aKlienci, int okresId, bool createKK)
{
foreach (SPListItem item in aKlienci)
{
Debug.WriteLine("klientId=" + item.ID.ToString());
SPFieldLookupValueCollection kody;
switch (item.ContentType.Name)
{
case "Osoba fizyczna":
case "Firma":
kody = new SPFieldLookupValueCollection(item["selSerwisyWspolnicy"].ToString());
break;
default:
kody = new SPFieldLookupValueCollection(item["selSewisy"].ToString());
break;
}
foreach (SPFieldLookupValue kod in kody)
{
switch (kod.LookupValue)
{
case @"RBR":
if (createKK) BLL.tabKartyKontrolne.Create_KartaKontrolna(web, item.ID, okresId);
Create_BR_Form(web, item.ID, okresId);
break;
default:
break;
}
}
}
}
开发者ID:fraczo,项目名称:Biuromagda,代码行数:34,代码来源:BR_Forms.cs
示例11: OpenFiles
public void OpenFiles(Array a)
{
string sError = "";
// process all files in array
for (int i = 0; i < a.Length; i++)
{
string sFile = a.GetValue(i).ToString();
FileInfo info = new FileInfo(sFile);
if (!info.Exists)
{
sError += "\nIncorrect file name: " + sFile;
}
else if (info.Name.ToLower().IndexOf(".srt") > -1)
{
tbSubtitle.Text = info.Name;
ShowGuess(sFile);
}
else if (info.Name.ToLower().IndexOf(".mkv") > -1)
{
tbMovie.Text = info.Name;
moviePath = info.FullName;
}
}
if (sError.Length > 0)
MessageBox.Show(this, sError, "Open File Error");
}
开发者ID:sheldongriffin,项目名称:srttrans,代码行数:30,代码来源:Form1.cs
示例12: Init
internal void Init(InternalPrimitiveTypeE code, Array array)
{
this.code = code;
switch (code)
{
case InternalPrimitiveTypeE.Boolean:
this.booleanA = (bool[]) array;
return;
case InternalPrimitiveTypeE.Byte:
case InternalPrimitiveTypeE.Currency:
case InternalPrimitiveTypeE.Decimal:
case InternalPrimitiveTypeE.TimeSpan:
case InternalPrimitiveTypeE.DateTime:
break;
case InternalPrimitiveTypeE.Char:
this.charA = (char[]) array;
return;
case InternalPrimitiveTypeE.Double:
this.doubleA = (double[]) array;
return;
case InternalPrimitiveTypeE.Int16:
this.int16A = (short[]) array;
return;
case InternalPrimitiveTypeE.Int32:
this.int32A = (int[]) array;
return;
case InternalPrimitiveTypeE.Int64:
this.int64A = (long[]) array;
return;
case InternalPrimitiveTypeE.SByte:
this.sbyteA = (sbyte[]) array;
return;
case InternalPrimitiveTypeE.Single:
this.singleA = (float[]) array;
return;
case InternalPrimitiveTypeE.UInt16:
this.uint16A = (ushort[]) array;
return;
case InternalPrimitiveTypeE.UInt32:
this.uint32A = (uint[]) array;
return;
case InternalPrimitiveTypeE.UInt64:
this.uint64A = (ulong[]) array;
break;
default:
return;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:60,代码来源:PrimitiveArray.cs
示例13: ConnectData
public object ConnectData(int topicId, ref Array strings, ref bool newValues)
{
var isin = strings.GetValue(0) as string;
LoggingWindow.WriteLine("Connecting: {0} {1}", topicId, isin);
lock (topics)
{
// create a listener for this topic
var listener = new SpotListener(isin);
listener.OnUpdate += (sender, args) =>
{
try
{
if (callback != null)
{
callback.UpdateNotify();
}
}
catch (COMException comex)
{
LoggingWindow.WriteLine("Unable to notify Excel: {0}", comex.ToString());
}
};
listener.Start();
topics.Add(topicId, listener);
}
return "WAIT";
}
开发者ID:grozeille,项目名称:TestExcelRtd,代码行数:31,代码来源:TestRtdServer.cs
示例14: LoadData
// Load data
public void LoadData( Array array )
{
//
this.array = array;
// set column and row headers
FixedRows = 1;
FixedColumns = 1;
// Redim the grid
Redim( array.GetLength( 0 ) + FixedRows, array.GetLength( 1 ) + FixedColumns );
// Col Header Cell Template
columnHeader = new CellColumnHeaderTemplate( );
columnHeader.BindToGrid( this );
// Row Header Cell Template
rowHeader = new CellRowHeaderTemplate( );
rowHeader.BindToGrid( this );
// Header Cell Template (0,0 cell)
cellHeader = new CellHeaderTemplate( );
cellHeader.BindToGrid( this );
// Data Cell Template
dataCell = new CellArrayTemplate( array ); ;
dataCell.BindToGrid( this );
RefreshCellsStyle( );
}
开发者ID:jdilt,项目名称:iplab,代码行数:31,代码来源:GridArray.cs
示例15: Main
public static void Main() {
Foo f = new Foo(0, 1);
Bar b = new Bar(0, 1, new Foo(0, 1));
Test t = new Test();
Date d = new Date("3/9/1976");
int[] items = new Array();
int[] items2 = new int[] { 1, 2 };
int[] items3 = { 4, 5 };
int[] items4 = new int[5];
ArrayList list = new ArrayList();
ArrayList list2 = new ArrayList(5);
ArrayList list3 = new ArrayList("abc", "def", "ghi");
ArrayList list4 = new ArrayList(1, 2, 3);
Date[] dates = new Date[] {
new Date("1/1/2006"),
new Date("1/1/2005") };
Point p = new Point(0, 0);
CustomDictionary cd = new CustomDictionary();
CustomDictionary cd2 = new CustomDictionary("abc", 123, "def", true);
object o1 = Script.CreateInstance(typeof(Test));
Type type1 = typeof(Foo);
object o2 = Script.CreateInstance(type1, 1, 2);
object o3 = Script.CreateInstance(typeof(Bar), 1, 2, (Foo)o2);
Function f1 = new Function("alert('hello');");
Function f2 = new Function("alert(s);", "s");
Function f3 = new Function("alert(greeting + ' ' + name + '!');", "greeting", "name");
}
开发者ID:fugaku,项目名称:scriptsharp,代码行数:32,代码来源:Code.cs
示例16: GridHackForm
public GridHackForm()
{
InitializeComponent();
this.Visible = false; // Form is hidden at launch
// Setup columns
windowGrid.AutoGenerateColumns = false;
for (int i = 0; i < gridSize; i++)
{
windowGrid.Columns.Add(new DataGridViewTextBoxColumn());
}
// Setup rows
Array[] rows = new Array[gridSize];
windowGrid.DataSource = rows;
// The DataGrid control is docked in Form, so calculate the form size so everything fits
// The last part isn't right (only works with the current gridWidth / gridHeight
this.ClientSize = new Size(gridSize * gridWidth, gridSize * gridHeight - (gridSize * 2 - 1));
// Register a global hotkey, the 8 is a bitmask, with the value of WIN_KEY
if (!RegisterHotKey(this.Handle, 1, 8, (int)Keys.Oemtilde))
{
MessageBox.Show("Hotkey not registered, GridHack running already?");
Application.Exit();
}
}
开发者ID:ZaneA,项目名称:GridHack,代码行数:28,代码来源:GridHackForm.cs
示例17: OnConnection
/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
/// <param term='application'>Root object of the host application.</param>
/// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
/// <param term='addInInst'>Object representing this Add-in.</param>
/// <seealso class='IDTExtensibility2' />
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
if (connectMode == ext_ConnectMode.ext_cm_UISetup)
{
object[] contextGUIDS = new object[] { };
Commands2 commands = (Commands2)_applicationObject.Commands;
CommandBars cBars = (CommandBars)_applicationObject.CommandBars;
try
{
Command commandProjectSettings = commands.AddNamedCommand2(_addInInstance, "DavecProjectSchemaSettings", "Davec Project Settings", "Manages Database Project Settings", false, 1, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);
Command commandAddSchemaUpdate = commands.AddNamedCommand2(_addInInstance, "DavecProjectUpdate", "Davec Update", "Updates Database Schema", false, 2, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);
CommandBar vsBarProject = cBars["Project"];
CommandBar vsBarFolder = cBars["Folder"];
commandProjectSettings.AddControl(vsBarProject, 1);
commandAddSchemaUpdate.AddControl(vsBarFolder, 1);
}
catch (System.ArgumentException)
{
//ignore
}
var _solutionEvents = _applicationObject.Events.SolutionEvents;
_solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);
var _documentEvents = _applicationObject.Events.DocumentEvents;
_documentEvents.DocumentSaved += new _dispDocumentEvents_DocumentSavedEventHandler(_documentEvents_DocumentSaved);
}
}
开发者ID:rajgit31,项目名称:VisualStudioExtensionSamples,代码行数:39,代码来源:Connect.cs
示例18: OnConnection
/// <summary>
/// Implements the OnDisconnection method of the IDTExtensibility2 interface.
/// Occurs when he Add-in is loaded into Visual Studio.
/// </summary>
/// <param name="application">A reference to an instance of the IDE, DTE.</param>
/// <param name="connectMode">
/// An <see cref="ext_ConnectMode"/> enumeration value that indicates
/// the way the add-in was loaded into Visual Studio.
/// </param>
/// <param name="instance">An <see cref="AddIn"/> reference to the add-in's own instance.</param>
/// <param name="custom">An empty array that you can use to pass host-specific data for use in the add-in.</param>
public void OnConnection(object application, ext_ConnectMode connectMode, object instance, ref Array custom)
{
App = (DTE2) application;
Instance = (AddIn) instance;
Events = App.Events as Events2;
Logger = new OutputWindowLogger(App);
Logger.Log("Loading...");
Compose(); // Do not attempt to use [Import]s before this line!
if(Chirp == null)
{
Logger.Log("Unable to load.");
return;
}
BindEvents();
PrintLoadedEngines();
Logger.Log("Ready");
if(App.Solution.IsOpen)
{
SolutionOpened();
foreach (var project in App.Solution.Projects.Cast<Project>())
{
ProjectAdded(project);
}
}
}
开发者ID:andyedinborough,项目名称:ChirpyMEF,代码行数:44,代码来源:ChirpyAddIn.cs
示例19: ForEach
/// <summary>
/// Modifies the specified array by applying the specified function to each element.
/// </summary>
/// <param name="a"></param>
/// <param name="func">object delegate(object o){}</param>
/// <returns></returns>
public static void ForEach(Array a, ForEachFunction func)
{
long[] ix = new long[a.Rank];
//Init index
for (int i = 0; i < ix.Length; i++) ix[i] = a.GetLowerBound(i);
//Loop through all items
for (long i = 0; i < a.LongLength; i++)
{
a.SetValue(func(a.GetValue(ix)), ix);
//Increment ix, the index
for (int j = 0; j < ix.Length; j++)
{
if (ix[j] < a.GetUpperBound(j))
{
ix[j]++;
break; //We're done incrementing.
}
else
{
//Ok, reset this one and increment the next.
ix[j] = a.GetLowerBound(j);
//If this is the last dimension, assert
//that we are at the last element
if (j == ix.Length - 1)
{
if (i < a.LongLength - 1) throw new Exception();
}
continue;
}
}
}
return;
}
开发者ID:pauldotknopf,项目名称:Noodle,代码行数:41,代码来源:PolygonMath.cs
示例20: DecodeFrameImpl
int DecodeFrameImpl(IMpegFrame frame, Array dest, int destOffset)
{
Decoder.LayerDecoderBase curDecoder = null;
switch (frame.Layer)
{
case MpegLayer.LayerI:
if (_layerIDecoder == null)
{
_layerIDecoder = new Decoder.LayerIDecoder();
}
curDecoder = _layerIDecoder;
break;
case MpegLayer.LayerII:
if (_layerIIDecoder == null)
{
_layerIIDecoder = new Decoder.LayerIIDecoder();
}
curDecoder = _layerIIDecoder;
break;
case MpegLayer.LayerIII:
if (_layerIIIDecoder == null)
{
_layerIIIDecoder = new Decoder.LayerIIIDecoder();
}
curDecoder = _layerIIIDecoder;
break;
}
if (curDecoder != null)
{
curDecoder.SetEQ(_eqFactors);
curDecoder.StereoMode = StereoMode;
var cnt = curDecoder.DecodeFrame(frame, _ch0, _ch1);
if (frame.ChannelMode == MpegChannelMode.Mono)
{
Buffer.BlockCopy(_ch0, 0, dest, destOffset * sizeof(float), cnt * sizeof(float));
}
else
{
// This is kinda annoying... if we're doing a downmix, we should technically only output a single channel
// The problem is, our caller is probably expecting stereo output. Grrrr....
// We use Buffer.BlockCopy here because we don't know dest's type, but do know it's big enough to do the copy
for (int i = 0; i < cnt; i++)
{
Buffer.BlockCopy(_ch0, i * sizeof(float), dest, destOffset * sizeof(float), sizeof(float));
++destOffset;
Buffer.BlockCopy(_ch1, i * sizeof(float), dest, destOffset * sizeof(float), sizeof(float));
++destOffset;
}
cnt *= 2;
}
return cnt;
}
return 0;
}
开发者ID:Daramkun,项目名称:Misty.Decoder.Mpeg,代码行数:60,代码来源:MpegFrameDecoder.cs
注:本文中的System.Array类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论