当前位置: 首页>>代码示例>>C#>>正文


C# Collection.GetType方法代码示例

本文整理汇总了C#中Collection.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Collection.GetType方法的具体用法?C# Collection.GetType怎么用?C# Collection.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Collection的用法示例。


在下文中一共展示了Collection.GetType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Deploy

 public static void Deploy(SPSolution solution, Collection<SPWebApplication> applications, int minCompat, int maxCompat, ILog log)
 {
     #if SP2013
     SPSolutionLanguagePack languagePack = solution.GetLanguagePack(0);
     SPCompatibilityRange compatibilityRange = new SPCompatibilityRange(minCompat, maxCompat);
     Type deployType = languagePack.GetType();
     Type[] argumentTypes = new Type[] { typeof(DateTime), applications.GetType(), typeof(SPSolutionDeploymentJobType), typeof(bool), typeof(bool), typeof(bool), compatibilityRange.GetType() };
     ParameterModifier[] modifiers = new ParameterModifier[] { new ParameterModifier(7) };
     MethodInfo deployMethod = deployType.GetMethod("CreateSolutionDeployTimerJob", BindingFlags.Instance | BindingFlags.NonPublic, null, argumentTypes, modifiers);
     DateTime jobTime = GetImmediateJobTime();
     object[] args = new object[] { jobTime, applications, SPSolutionDeploymentJobType.Deploy, true, true, false, compatibilityRange };
     deployMethod.Invoke(languagePack, args);
     #endif
 }
开发者ID:CherifSy,项目名称:sharepointinstaller,代码行数:14,代码来源:CompatibilityDeployer.cs

示例2: FromXml

        public static Collection<PackageItem> FromXml(string data)
        {
            Collection<PackageItem> result = new Collection<PackageItem>();

            try
            {
                StringReader tr = new StringReader(data);
                XmlSerializer xs = new XmlSerializer(result.GetType());                
                result = (Collection<PackageItem>)xs.Deserialize(tr);
                if (result == null) result = new Collection<PackageItem>();                
            }
            catch
            {
                result = new Collection<PackageItem>();
            }

            return result;
        }
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:18,代码来源:PackageItem.cs

示例3: ValidateTryGetType

        public void ValidateTryGetType()
        {
            Type returnType;
            int num = 0;
            Assert.IsTrue(TypeFactory.TryGetType("int", num.GetType(), out returnType));
            Assert.IsTrue(TypeFactory.TryGetType("int32", num.GetType(), out returnType));

            long longVar = 0;
            Assert.IsTrue(TypeFactory.TryGetType("long", longVar.GetType(), out returnType));
            Assert.IsTrue(TypeFactory.TryGetType("int64", longVar.GetType(), out returnType));
            
            string strVar = string.Empty;
            Assert.IsTrue(TypeFactory.TryGetType("string", strVar.GetType(), out returnType));

            double doubleVar = 1.234;
            Assert.IsTrue(TypeFactory.TryGetType("double", doubleVar.GetType(), out returnType));

            Collection<int> intColl = new Collection<int>();
            intColl.Add(1);
            Assert.IsTrue(TypeFactory.TryGetType("System.Collections.ObjectModel.Collection`1[System.Int32]", intColl.GetType(), out returnType));
        }
开发者ID:cpatmoore,项目名称:bio,代码行数:21,代码来源:TypeFactoryBvtTestCases.cs

示例4: InvalidateTryGetType

        public void InvalidateTryGetType()
        {
            try
            {
                Type returnType;
                int num = 0;
                bool check = TypeFactory.TryGetType(null, num.GetType(), out returnType);
                Assert.Fail();
            }
            catch (ArgumentNullException anex)
            {
                ApplicationLog.WriteLine("Successfully caught ArgumentNullException : " + anex.Message);
            }
            try
            {
                Type returnType;
                bool check = TypeFactory.TryGetType("int", null, out returnType);
                Assert.Fail();
            }
            catch (ArgumentNullException anex)
            {
                ApplicationLog.WriteLine("Successfully caught ArgumentNullException : " + anex.Message);
            }

            try
            {
                Type returnType;
                Collection<int> intcoll = new Collection<int>();
                intcoll.Add(1);
                bool check = TypeFactory.TryGetType("<>", intcoll.GetType(), out returnType);
                Assert.Fail();
            }
            catch (ArgumentNullException ex)
            {
                ApplicationLog.WriteLine("Successfully caught Exception : " + ex.Message);
            }
        }
开发者ID:cpatmoore,项目名称:bio,代码行数:37,代码来源:TypeFactoryP2TestCases.cs

示例5: Save

 /// <summary>
 /// Save images list
 /// </summary>
 /// <param name="list"></param>
 public static void Save(Collection<ImageItem> list)
 {
     try
     {
         using (var writer = new StreamWriter(GetPath(PictureSlidesLabImagesList)))
         {
             var serializer = new XmlSerializer(list.GetType());
             serializer.Serialize(writer, list);
             writer.Flush();
         }
     }
     catch (Exception e)
     {
         PowerPointLabsGlobals.Log("Failed to save Picture Slides Lab settings: " + e.StackTrace, "Error");
     }
 }
开发者ID:digawp,项目名称:PowerPointLabs,代码行数:20,代码来源:StoragePath.cs

示例6: TypeTestForCollection

 public void TypeTestForCollection()
 {
     Collection<object> cx = new Collection<object>();
     
     StringAssert.Contains("System.Collections.ObjectModel.Collection`1[System.Object]", cx.GetType().ToString());
 }
开发者ID:irinabov,项目名称:debian-qpid-cpp,代码行数:6,代码来源:messaging.test.cs

示例7: Save

 /// <summary>
 /// Save images list
 /// </summary>
 /// <param name="list"></param>
 public static void Save(Collection<ImageItem> list)
 {
     try
     {
         using (var writer = new StreamWriter(GetPath(PictureSlidesLabImagesList)))
         {
             var serializer = new XmlSerializer(list.GetType());
             serializer.Serialize(writer, list);
             writer.Flush();
         }
     }
     catch (Exception e)
     {
         Logger.LogException(e, "Failed to save Picture Slides Lab images list");
     }
 }
开发者ID:nus-fboa2016-PL,项目名称:PowerPointLabs,代码行数:20,代码来源:StoragePath.cs


注:本文中的Collection.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。