本文整理汇总了C#中System.Array类的典型用法代码示例。如果您正苦于以下问题:C# Array类的具体用法?C# Array怎么用?C# Array使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Array类属于System命名空间,在下文中一共展示了Array类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: Method1
static void Method1(ref byte param1)
{
for (; m_bFlag; param1 = param1)
{
Array[] a = new Array[2];
}
}
示例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);
}
示例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;
}
示例5: ThrowIfIsNullOrEmpty
public static void ThrowIfIsNullOrEmpty(Array array)
{
if (array == null || array.Length == 0)
{
throw new ArgumentNullException();
}
}
示例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);
}
示例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("}");
}
}
}
示例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
// {
// }
//}
}
示例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;
}
}
示例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;
}
}
}
}
示例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");
}
示例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;
}
}
示例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";
}
示例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( );
}
示例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");
}