本文整理汇总了C#中__arglist类的典型用法代码示例。如果您正苦于以下问题:C# __arglist类的具体用法?C# __arglist怎么用?C# __arglist使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
__arglist类属于命名空间,在下文中一共展示了__arglist类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: argit3
public static void argit3( __arglist )
{
ArgIterator args = new ArgIterator( __arglist );
try
{
int argCount = args.GetRemainingCount();
for (int i = 0; i < argCount; i++)
{
TypedReference trTypRef = args.GetNextArg();
}
}
catch(Exception ex)
{
throw new Exception( "ExcErr007 ," + ex.ToString() );
}
for ( int j = 0; j < 5; j++ )
{
try
{
RuntimeTypeHandle rthRunTypHan = args.GetNextArgType();
throw new Exception( "ExcErr006 , Last call should have thrown." );
}
catch (InvalidOperationException)
{}
}
}
开发者ID:ArildF,项目名称:masters,代码行数:26,代码来源:co1827argiterator.cs
示例2: ArglistMethod
private static void ArglistMethod (__arglist)
{
var iter = new ArgIterator (__arglist);
for (int n = iter.GetRemainingCount (); n > 0; n--)
Console.WriteLine (TypedReference.ToObject (iter.GetNextArg ()));
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:test-704.cs
示例3: TestTypes
// Helper method for "TestArgIteratorGetType".
private void TestTypes(String testNum, Type[] types, __arglist)
{
ArgIterator iter = new ArgIterator(__arglist);
int count = iter.GetRemainingCount();
AssertEquals("Length " + testNum, types.Length, count);
while(count > 0)
{
Type type = Type.GetTypeFromHandle
(iter.GetNextArgType());
AssertEquals("TypeCheck " + testNum,
types[types.Length - count], type);
AssertEquals("Remaining " + testNum,
count, iter.GetRemainingCount());
iter.GetNextArg();
--count;
}
try
{
iter.GetNextArgType();
Fail("EndCheck " + testNum);
}
catch(InvalidOperationException)
{
// We expect this exception at the end of the list.
}
AssertEquals("Remaining " + testNum, 0,
iter.GetRemainingCount());
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:29,代码来源:TestArgIterator.cs
示例4: EnumTest
public static long EnumTest(__arglist)
{
ArgIterator args = new ArgIterator(__arglist);
long S = 0;
while (args.GetRemainingCount() > 0)
{
if (args.GetNextArgType().Equals(typeof(Enum1).TypeHandle))
{
Enum1 e = __refvalue(args.GetNextArg(), Enum1);
Console.WriteLine("Got Enum1, value = " + e + " = " + (long)e);
S += (long)e;
}
if (args.GetNextArgType().Equals(typeof(Enum8).TypeHandle))
{
Enum8 e = __refvalue(args.GetNextArg(), Enum8);
Console.WriteLine("Got Enum8, value = " + e + " = " + (long)e);
S += (long)e;
}
if (args.GetNextArgType().Equals(typeof(Enum16).TypeHandle))
{
Enum16 e = __refvalue(args.GetNextArg(), Enum16);
Console.WriteLine("Got Enum16, value = " + e + " = " + (long)e);
S += (long)e;
}
if (args.GetNextArgType().Equals(typeof(Enuml).TypeHandle))
{
Enuml e = __refvalue(args.GetNextArg(), Enuml);
Console.WriteLine("Got Enuml, value = " + e + " = " + (long)e);
S += (long)e;
}
}
return S;
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:33,代码来源:varargtest.cs
示例5: Sum
public static int Sum(int a, double b, int c, float d, __arglist)
{
ArgIterator args = new ArgIterator(__arglist);
int S = a + (int)b + c + (int)d;
while(args.GetRemainingCount() > 0)
{
if (args.GetNextArgType().Equals(typeof(int).TypeHandle))
{
int N = __refvalue(args.GetNextArg(), int);
Console.WriteLine("int value is "+N);
S = S + N;
}
else if (args.GetNextArgType().Equals(typeof(string).TypeHandle))
{
string s = __refvalue(args.GetNextArg(), string);
Console.WriteLine("string value is "+s);
}
else if (args.GetNextArgType().Equals(typeof(MyStruct).TypeHandle))
{
MyStruct st = __refvalue(args.GetNextArg(), MyStruct);
Console.WriteLine("MyStruct value is "+st.x+" "+st.y);
S = S + 2*st.x + 3*st.y;
}
else
return -1;
}
return S;
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:28,代码来源:varargtest.cs
示例6: argit1
public static void argit1( __arglist )
{
ArgIterator args = new ArgIterator( __arglist );
int iCount = args.GetRemainingCount();
for ( int i = 0; i < iCount + 15; i++ ){
try {
try {
TypedReference trTypRef = args.GetNextArg();
}
catch (InvalidOperationException){}
if (args.GetRemainingCount()!=0)
if ( args.GetRemainingCount() != (iCount - i - 1) ){
throw new Exception( "ExcErr5 ,Should have had remaining count " + (iCount - i - 1) + " but had remaining count " + args.GetRemainingCount() );
}
}
catch(Exception ex){
if ( i < iCount )
Console.WriteLine( "Err_argit4_00: Loop has not gone through only " + i + " arguments" );
int iRemCount = args.GetRemainingCount();
if ( iRemCount != 0 ){
Console.WriteLine( "Err_argit4_01: Should have had remaining count 0 but had remaining count " + iRemCount );
}
throw ex;
}
}
if ( args.GetRemainingCount() != 0 ){
throw new Exception( "ExcErr4 ,Should have had remaining count 0");
}
}
开发者ID:ArildF,项目名称:masters,代码行数:29,代码来源:co6664getremainingcount.cs
示例7: TestRefValue
static void TestRefValue (__arglist)
{
ArgIterator args = new ArgIterator (__arglist);
var o = __refvalue ( args.GetNextArg (),int);
for (int i = 0; i < args.GetRemainingCount (); i++) {
Console.WriteLine (__refvalue (args.GetNextArg (), int));
}
}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:test-811.cs
示例8: DisplayNumbersOnConsole
public static void DisplayNumbersOnConsole(__arglist)
{
ArgIterator ai = new ArgIterator(__arglist);
while (ai.GetRemainingCount() > 0)
{
TypedReference tr = ai.GetNextArg();
Console.WriteLine(TypedReference.ToObject(tr));
}
}
开发者ID:kennedykinyanjui,项目名称:Projects,代码行数:9,代码来源:ArglistTest.cs
示例9: VariableArguments
public void VariableArguments(__arglist)
{
ArgIterator argumentIterator = new ArgIterator(__arglist);
for(int i = 0; i < argumentIterator.GetRemainingCount(); i++)
{
Console.WriteLine(
__refvalue(argumentIterator.GetNextArg(), string));
}
}
开发者ID:terryjintry,项目名称:OLSource1,代码行数:9,代码来源:ca2230--use-params-for-variable-arguments_1.cs
示例10: Test
static void Test(int param, __arglist)
{
int[,] aa = new int[2, 2];
do
{
try { }
catch (Exception) { }
aa[param, Math.Min(0, 1)] = 0;
} while ((new bool[2, 2])[param, param]);
}
开发者ID:CheneyWu,项目名称:coreclr,代码行数:10,代码来源:b91248.cs
示例11: argit2b
public static void argit2b (__arglist)
{
ArgIterator args = new ArgIterator( __arglist );
int hashcode = args.GetHashCode();
TypedReference trTypRef = args.GetNextArg();
int hashcodecompare= args.GetHashCode();
if (! hashcode.Equals(hashcodecompare))
{
throw new Exception( "argit2b - 1, hashcode changed" );
}
}
开发者ID:ArildF,项目名称:masters,代码行数:11,代码来源:co6665gethashcode.cs
示例12: Foo
public static void Foo (__arglist)
{
System.RuntimeArgumentHandle o;
{
System.Action a = delegate () {
o = __arglist;
};
a ();
}
}
开发者ID:nlhepler,项目名称:mono,代码行数:11,代码来源:cs0190-2.cs
示例13: Arrangements
/// <summary>
/// Arrangements the specified n and list of argument.
/// A = n! / [(n_1)!.(n_2)!. ... . (n_i)!]
/// </summary>
/// <param name='...'>
/// List of arguments
/// </param>
public static Int64 Arrangements(Int32 n, __arglist)
{
Int64 result = 1;
ArgIterator iter = new ArgIterator(__arglist);
Int32 argCount = iter.GetRemainingCount();
for (Int32 i = 0; i < argCount; i++) {
TypedReference typedRef = iter.GetNextArg();
result *= Factorial((Int32)TypedReference.ToObject( typedRef ) );
}
return Factorial(n)/result;
}
开发者ID:kaptainzero,项目名称:monomath,代码行数:20,代码来源:Numbers.cs
示例14: argit1
//Test 1
// check whether GetHashCode returns the same value
// check to see if we can use ArgIterators on any class
// check ArgIterators on Arrays
// test arg iterators with instance methods on normal classes
public TestStruct argit1( Object[] objExpectedArr, __arglist )
{
ArgIterator args = new ArgIterator( __arglist );
int hashcode = args.GetHashCode();
int iCount = args.GetRemainingCount();
Console.WriteLine( "Found "+ iCount +" arguments. " );
Object[] objArr = new Object[iCount];
for ( int i = 0; i < iCount; i++ ){
objArr[i] = TypedReference.ToObject(args.GetNextArg());
Console.WriteLine( "Object " + i + ": " + objArr[i] + " Expected: " + objExpectedArr[i] );
if ( objExpectedArr[i] == null ){
if ( objArr[i] != null ){
throw new Exception( "argit1 - 1, __arglist[i] was null but it did not equal to objExpectedArr[i]" );
}
}
else if ( ! objArr[i].Equals( objExpectedArr[i] ) ) {
throw new Exception( "argit1 - 2, __arglist[i] was null but it did not equal to objExpectedArr[i]" );
}
}
//repeating the code above __arglist should be valid in method scope
ArgIterator args2 = new ArgIterator( __arglist );
int iCount2 = args2.GetRemainingCount();
Object[] objArr2 = new Object[iCount];
for ( int i = 0; i < iCount2; i++ ){
objArr2[i] = TypedReference.ToObject(args2.GetNextArg());
Console.WriteLine( "Object " + i + ": " + objArr2[i] + " Expected: " + objExpectedArr[i] );
if ( objExpectedArr[i] == null ){
if ( objArr2[i] != null ){
throw new Exception( "argit1 - 3, __arglist[i] was null but it did not equal to objExpectedArr[i]" );
}
}
else if ( ! objArr2[i].Equals( objExpectedArr[i] ) ) {
throw new Exception( "argit1 - 4, __arglist[i] was null but it did not equal to objExpectedArr[i]" );
}
}
int hashcodecompare= args.GetHashCode();
if (! hashcode.Equals(hashcodecompare))
{
throw new Exception( "argit1 - 5, hashcode changed" );
}
TestStruct Bar = new TestStruct();
Bar.foo1 = 1;
Bar.foo2 = 2;
return Bar;
}
开发者ID:ArildF,项目名称:masters,代码行数:56,代码来源:varargtest2.cs
示例15: argit2
public static void argit2 (__arglist)
{
ArgIterator args = new ArgIterator( __arglist );
int hashcode = args.GetHashCode();
try{
NormClass.argit2b( __arglist( ) );
}
catch (InvalidOperationException) {}
int hashcodecompare= args.GetHashCode();
if (! hashcode.Equals(hashcodecompare))
{
throw new Exception( "argit2 - 1, hashcode changed" );
}
}
开发者ID:ArildF,项目名称:masters,代码行数:14,代码来源:co6665gethashcode.cs
示例16: AddABunchOfShorts
static int AddABunchOfShorts (__arglist)
{
int result = 0;
System.ArgIterator iter = new System.ArgIterator (__arglist);
int argCount = iter.GetRemainingCount();
for (int i = 0; i < argCount; i++) {
System.TypedReference typedRef = iter.GetNextArg();
result += (short)TypedReference.ToObject( typedRef );
}
return result;
}
开发者ID:Zman0169,项目名称:mono,代码行数:14,代码来源:vararg2.cs
示例17: VtAddASecondBunchOfInts
public static Result VtAddASecondBunchOfInts (int a, __arglist)
{
int result = 0;
System.ArgIterator iter = new System.ArgIterator (__arglist);
int argCount = iter.GetRemainingCount();
for (int i = 0; i < argCount; i++) {
System.TypedReference typedRef = iter.GetNextArg();
result += (int)TypedReference.ToObject( typedRef );
}
return new Result (result);
}
开发者ID:nobled,项目名称:mono,代码行数:14,代码来源:test-399-lib.cs
示例18: Method1
static void Method1(ref ulong param1, __arglist)
{
bool a = false;
while (a)
{
do
{
#pragma warning disable 1717
param1 = param1;
#pragma warning restore 1717
while (a) { }
} while (a);
}
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:14,代码来源:b88793.cs
示例19: Flexible
/// <summary>
/// Hey children - don't do that at home
/// </summary>
public static void Flexible(__arglist)
{
// Actually pretty raw access here
var ai = new ArgIterator(__arglist);
while (ai.GetRemainingCount() > 0)
{
var typeRef = ai.GetNextArg();
// Need to get the object reference from the
// combined (typeref, objectref) element
var obj = TypedReference.ToObject(typeRef);
Debug.WriteLine(obj);
}
}
开发者ID:modulexcite,项目名称:DWX-Trickbox,代码行数:18,代码来源:VarArgs.cs
示例20: Write
/// <summary>
/// Write the specified color, format, arg0, arg1, arg2, arg3 and .
/// </summary>
/// <param name="">.</param>
/// <param name="format">Format.</param>
/// <param name="arg0">Arg0.</param>
/// <param name="arg1">Arg1.</param>
/// <param name="arg2">Arg2.</param>
/// <param name="arg3">Arg3.</param>
public static void Write(System.ConsoleColor color, string format, object arg0, object arg1, object arg2, object arg3, __arglist
)
{
ArgIterator argIterator = new ArgIterator (__arglist);
int remainingCount = argIterator.GetRemainingCount ();
object[] array = new object[remainingCount + 4];
array [0] = arg0;
array [1] = arg1;
array [2] = arg2;
array [3] = arg3;
for (int i = 0; i < remainingCount; i++) {
TypedReference nextArg = argIterator.GetNextArg ();
array [i + 4] = TypedReference.ToObject (nextArg);
}
var old_font = Console.ForegroundColor;
Console.ForegroundColor = color;
Console.Write (string.Format (format, array));
Console.ForegroundColor = old_font;
}
开发者ID:AlkindiX,项目名称:packager,代码行数:28,代码来源:ConsoleColor.cs
注:本文中的__arglist类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论