本文整理汇总了C#中System.Object.Count方法的典型用法代码示例。如果您正苦于以下问题:C# Object.Count方法的具体用法?C# Object.Count怎么用?C# Object.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Object
的用法示例。
在下文中一共展示了Object.Count方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: buildXMLStringWithPara
//fügt die Parameter hinzu (für Token)
public static string buildXMLStringWithPara(Object[] parameters)
{
var genParams = "";
if (parameters != null && parameters.Count() > 0)
{
foreach (var param in parameters)
{
if (param == null) continue;
if (param.GetType().Equals(typeof(string)))
{
genParams += string.Format(@"<param><value><string>{0}</string></value></param>", param);
}
if (param.GetType().Equals(typeof(bool)))
{
genParams += string.Format(@"<param><value><boolean>{0}</boolean></value></param>", (bool)param ? 1 : 0);
}
if (param.GetType().Equals(typeof(double)))
{
genParams += string.Format(@"<param><value><double>{0}</double></value></param>", param);
}
if (param.GetType().Equals(typeof(int)) || param.GetType().Equals(typeof(short)))
{
genParams += string.Format(@"<param><value><int>{0}</int></value></param>", param);
}
if (param.GetType().Equals(typeof(DateTime)))
{
genParams +=
string.Format(
@"<param><value><dateTime.iso8601>{0:yyyy}{0:MM}{0:dd}T{0:hh}:{0:mm}:{0:ss}</dateTime.iso8601></value></param>",
param);
}
}
}
return genParams;
}
示例2: MainWindow
//private Journal journal;
//private Schedules schedules;
public MainWindow()
{
InitializeComponent();
Object[] students = new Object[15];
for (int i = 0; i < students.Count(); i++)
students[i] = "Student #" + (i + 1);
DrawScene(students, "02/09/2014");
//journal = new Journal();
//schedules = new Schedules();
}
示例3: InvokeMethod
public static Object InvokeMethod(string AssemblyName,string ClassName, string MethodName, Object[] args)
{
// load the assemly
Assembly assembly = Assembly.LoadFrom(AssemblyName);
try
{
// Walk through each type in the assembly looking for our class
foreach (Type type in assembly.GetTypes())
{
if (type.IsClass == true)
{
if (type.FullName.EndsWith("." + ClassName))
{
if (type.IsAbstract)
{
//Static method.
return type.InvokeMember(
MethodName,
BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Static,
null,
null,
args);
}
else
{
// create an instance of the object
object ClassObj = Activator.CreateInstance(type);
// Dynamically Invoke the method
object Result = type.InvokeMember(MethodName,
BindingFlags.Default | BindingFlags.InvokeMethod,
null,
ClassObj,
args);
return (Result);
}
}
}
}
}
catch (MissingMethodException ex)
{
throw (new System.Exception(ex.Message + ", with " + args.Count().ToString() + " parameters, " + ex.InnerException.ToString()));
}
throw (new System.Exception("unhandled exception"));
}
示例4: run
public Object run(Object[] args)
{
Double res = 0d;
double[] x = new double[2];
if (args.Count() == 2)
{
for (int i = 0; i < 2; i++)
x[i] = Convert.ToDouble((args[i].ToString().Trim()).Replace('.', ','));
res = Convert.ToDouble(x[0]) % Convert.ToDouble(x[1]);
}
else
{
return "###";
}
return res.ToString();
}
示例5: run
public Object run(Object[] args)
{
Double res = 0d;
double x = new double();
if (args.Count() == 1)
{
x = Convert.ToDouble((args[0].ToString().Trim()).Replace('.', ','));
res = Math.Sqrt(Convert.ToDouble(x));
}
else
{
return "###";
}
return res.ToString();
}
示例6: DoDataChange
public override void DoDataChange(Object[] parameter)
{
if(parameter.Count()<3)
{
Log.Warning("invalid parameter count for custom ribbon change");
return;
}
String s0 = parameter[0] as String;
String s1 = parameter[1] as String;
String s2 = parameter[2] as String;
if (s0 == null || s1 == null || s2 == null)
{
Log.Warning("invalid parameter type for custom ribbon change");
return;
}
String code = "X" + s0.Substring(2);
String name = s1;
String text = s2;
if (Log.IsLogable(Log.LEVEL.TRACE)) Log.Trace("changing custom ribbon for code " + code);
Ribbon ribbon = RibbonPool.Instance().GetRibbonForCode(code);
if (ribbon == null)
{
Log.Error("invalid custom ribbon code: " + code);
return;
}
//
CustomAchievement achievement = ribbon.GetAchievement() as CustomAchievement;
if (achievement == null)
{
Log.Error("invalid custom ribbon achievement");
return;
}
achievement.SetName(name);
achievement.SetText(text);
if (Log.IsLogable(Log.LEVEL.TRACE)) Log.Trace("custom ribbon changed");
}
示例7: run
public Object run(Object[] args)
{
Double res = Convert.ToDouble(args[0].ToString().Trim().Replace('.', ','));
for (int i=1;i<args.Count();i++)
{
if (args[i].ToString().Length > 0)
{
// foreach (String s in arg.ToString().Split(','))
//res -= Convert.ToDouble(s.Trim().Replace('.', ','));
var akt = Convert.ToDouble(args[i].ToString().Trim().Replace('.', ','));
res -= akt;
}
else
{
return "###";
}
}
return res.ToString();
}
示例8: GetNumberOfStud
//Возвращает количество студентов
public int GetNumberOfStud(Object[] stud)
{
return stud.Count();
}
示例9: EmitArgs
private void EmitArgs(Object[] args)
{
if (args == null)
{
LogText("No Args?");
}
LogText("Args: {0}", args.Count());
int a = 0;
foreach (var arg in args)
{
LogText("Arg #{0}", a++);
var type = arg.GetType();
if (type == typeof (JArray))
{
EmitJArray(arg as JArray, 0);
}
else if (type == typeof (JToken))
{
EmitJToken(arg as JToken, 0);
}
else if (type == typeof (JObject))
{
EmitJObject(arg as JObject, 0);
}
else if (type == typeof (string))
{
LogText("Value: {0}", (string) arg);
}
else
{
LogText("Unknown Arg Type? {0}", arg.GetType().Name);
}
}
}
示例10: CreateTextFileContentObject
private textfilecontent54_object CreateTextFileContentObject(
EntityObjectStringType filePath,
EntityObjectStringType fileName,
EntityObjectStringType path,
EntityObjectStringType pattern,
EntityObjectIntType instance,
Object[] behaviors)
{
var fileContentObject = new textfilecontent54_object();
object[] items;
textfilecontent54_ItemsChoices[] itemChoices;
var hasBehaviors = (behaviors != null) && (behaviors.Count() > 0);
var behaviorCount = behaviors.Count();
if (filePath == null)
{
if (hasBehaviors)
{
var entityCount = behaviorCount + 4;
items = new object[entityCount];
itemChoices = new textfilecontent54_ItemsChoices[entityCount];
for (int i = 0; i < behaviorCount; i++)
{
itemChoices[i] = textfilecontent54_ItemsChoices.behaviors;
items[i] = behaviors.ElementAt(i);
}
itemChoices[behaviorCount] = textfilecontent54_ItemsChoices.path;
itemChoices[behaviorCount + 1] = textfilecontent54_ItemsChoices.filename;
itemChoices[behaviorCount + 2] = textfilecontent54_ItemsChoices.pattern;
itemChoices[behaviorCount + 3] = textfilecontent54_ItemsChoices.instance;
items[behaviorCount] = path;
items[behaviorCount + 1] = fileName;
items[behaviorCount + 2] = pattern;
items[behaviorCount + 3] = instance;
}
else
{
items = new EntitySimpleBaseType[4];
itemChoices = new textfilecontent54_ItemsChoices[4];
itemChoices[0] = textfilecontent54_ItemsChoices.path;
itemChoices[1] = textfilecontent54_ItemsChoices.filename;
itemChoices[2] = textfilecontent54_ItemsChoices.pattern;
itemChoices[3] = textfilecontent54_ItemsChoices.instance;
items[0] = path;
items[1] = fileName;
items[2] = pattern;
items[3] = instance;
}
}
else
{
if (hasBehaviors)
{
var entityCount = behaviorCount + 3;
items = new object[entityCount];
itemChoices = new textfilecontent54_ItemsChoices[entityCount];
for (int i = 0; i < behaviorCount; i++)
{
itemChoices[i] = textfilecontent54_ItemsChoices.behaviors;
items[i] = behaviors.ElementAt(i);
}
itemChoices[behaviorCount] = textfilecontent54_ItemsChoices.filepath;
itemChoices[behaviorCount + 1] = textfilecontent54_ItemsChoices.pattern;
itemChoices[behaviorCount + 2] = textfilecontent54_ItemsChoices.instance;
items[behaviorCount] = filePath;
items[behaviorCount + 1] = pattern;
items[behaviorCount + 2] = instance;
}
else
{
items = new EntitySimpleBaseType[3];
itemChoices = new textfilecontent54_ItemsChoices[3];
itemChoices[0] = textfilecontent54_ItemsChoices.filepath;
itemChoices[1] = textfilecontent54_ItemsChoices.pattern;
itemChoices[2] = textfilecontent54_ItemsChoices.instance;
items[0] = filePath;
items[1] = pattern;
items[2] = instance;
}
}
fileContentObject.Items = items;
fileContentObject.Textfilecontent54ItemsElementName = itemChoices;
return fileContentObject;
}