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


C# Flags类代码示例

本文整理汇总了C#中Flags的典型用法代码示例。如果您正苦于以下问题:C# Flags类的具体用法?C# Flags怎么用?C# Flags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getRequestJSONObject

        private JObject getRequestJSONObject(List<Placement> placements, Flags flags = null, string medium = null, string frame = null, string title = null, bool useIframe = false)
        {
            JObject jsonObject = new JObject();

            if (placements != null && placements.Count > 0) {
                JArray placementsJSONArray = new JArray();
                foreach (var placement in placements) {
                    placementsJSONArray.Add(JObject.Parse(base.jsonSerializer.Serialize(placement)));
                }
                jsonObject.Add("placements", placementsJSONArray);
            }

            if (flags != null) {
                jsonObject.Add("flags", JObject.Parse(base.jsonSerializer.Serialize(flags)));
            }

            if (medium != null) {
                jsonObject.Add("medium", new JValue(medium));
            }

            if (frame != null) {
                jsonObject.Add("frame", new JValue(frame));
            }

            if (title != null) {
                jsonObject.Add("title", new JValue(title));
            }

            jsonObject.Add("useiframe", new JValue(useIframe));

            return jsonObject;
        }
开发者ID:trafficspaces,项目名称:trafficspaces-api-csharp,代码行数:32,代码来源:PlacementConnector.cs

示例2: MapCallInfo

 public MapCallInfo(Type targetType, Type[] genericTypes, Flags bindingFlags, MemberTypes memberTypes, string name, Type[] parameterTypes, MemberInfo memberInfo, bool isReadOperation, Type sourceType, MemberTypes sourceMemberTypes, MemberTypes targetMemberTypes, string[] names) : base(targetType, genericTypes, bindingFlags, memberTypes, name, parameterTypes, memberInfo, isReadOperation)
 {
     SourceType = sourceType;
     SourceMemberTypes = sourceMemberTypes;
     TargetMemberTypes = targetMemberTypes;
     Names = names;
 }
开发者ID:devworker55,项目名称:Mammatus,代码行数:7,代码来源:MapCallInfo.cs

示例3: SetFlag

 public void SetFlag(Flags flag, bool b)
 {
     if (b)
         StatusRegister |= (byte)flag;
     else
         StatusRegister &= (byte)~flag;
 }
开发者ID:Cyberlane,项目名称:LeetNES,代码行数:7,代码来源:CpuState.cs

示例4: DelegateForGetIndexer

 /// <summary>
 /// Creates a delegate which can get the value of an indexer matching <paramref name="bindingFlags"/>.
 /// </summary>
 /// <param name="type">The type which the indexer belongs to.</param>
 /// <param name="bindingFlags">The binding flags used to lookup the indexer.</param>
 /// <param name="parameterTypes">The types of the indexer parameters (must be in the right order).</param>
 /// <returns>The delegate which can get the value of an indexer.</returns>
 public static MethodInvoker DelegateForGetIndexer( this Type type, Flags bindingFlags,
                                                    params Type[] parameterTypes )
 {
     return (MethodInvoker)
         new MethodInvocationEmitter( type, bindingFlags, Constants.IndexerGetterName, parameterTypes ).
             GetDelegate();
 }
开发者ID:nintorii,项目名称:Zenject,代码行数:14,代码来源:PropertyExtensions.cs

示例5: SendMail

        public static void SendMail(Flags flag)
        {
            Flags result = 0x00;
            // Define action-lookup
            int intero = 1;
            //string stringa = "email";

            var actionsByFlag = new Dictionary<Flags, Func<int, Flags>>
            {
                { Flags.Notify, Notify },
                { Flags.Email, Email }
            };

            // Find applicable actions
            var actions = actionsByFlag.Where(kvp => (flag & kvp.Key) == kvp.Key)
                                       .Select(kvp => kvp.Value);

            //Execute applicable actions
            foreach (var action in actions)
                result = result | action(intero);

            Console.WriteLine("Risultato");
            Console.WriteLine(result);
            Console.ReadLine();
        }
开发者ID:AngeloNutile,项目名称:MyFirstGitProject,代码行数:25,代码来源:Program.cs

示例6: Awake

 void Awake()
 {
     GameObject c = GameObject.FindGameObjectWithTag ("GameController");
     flags = c.GetComponent<Flags>();
     transition = GameObject.FindGameObjectWithTag("Fader").GetComponent<SceneTransition>();
     flags.AddCutsceneFlag(cutsceneDialogue.name);
 }
开发者ID:CatsFromMars,项目名称:Kura5,代码行数:7,代码来源:Cutscene.cs

示例7: Resolve_Nosynonyms_ArgumentNotFound_ReturnsNull

        public void Resolve_Nosynonyms_ArgumentNotFound_ReturnsNull()
        {
            var flags = new Flags();

            var result = flags.Resolve("argument");

            Assert.IsNull(result);
        }
开发者ID:olegd,项目名称:ArgumentsParser,代码行数:8,代码来源:FlagsTests.cs

示例8: Resolve_Twosynonyms_ResolveSecondsynonym_ReturnsArgument

        public void Resolve_Twosynonyms_ResolveSecondsynonym_ReturnsArgument()
        {
            var flags = new Flags();
            flags.Add("argument", "-a", "--a");

            var result = flags.Resolve("--a");

            Assert.That(result, Is.EqualTo("argument"));
        }
开发者ID:olegd,项目名称:ArgumentsParser,代码行数:9,代码来源:FlagsTests.cs

示例9: Resolve_Nosynonyms_ArgumentFound_ReturnsArgument

        public void Resolve_Nosynonyms_ArgumentFound_ReturnsArgument()
        {
            var flags = new Flags();
            flags.Add("argument");

            var result = flags.Resolve("argument");

            Assert.That(result, Is.EqualTo("argument"));
        }
开发者ID:olegd,项目名称:ArgumentsParser,代码行数:9,代码来源:FlagsTests.cs

示例10: InitializeResolver

 public static void InitializeResolver(Flags f)
 {
     UrlResolver.HrefResolver =
         new Lazy<IPathResolver>(
             () =>
             new ContentResolver
             {
                 ContentDir = f.WebAppRoot
             });
 }
开发者ID:lcaballero,项目名称:LucidEdge,代码行数:10,代码来源:Program.cs

示例11: Line

 public Line(float x, float y, float x2, float y2, float a, float a2, Flags flags, int priority)
     : base(flags, priority << 16)
 {
     X = x;
     Y = y;
     X2 = x2;
     Y2 = y2;
     _a = a;
     _a2 = a2;
 }
开发者ID:cadahl,项目名称:defense,代码行数:10,代码来源:Line.cs

示例12: VisualStudioHelper

		internal VisualStudioHelper()
		{
			ScratchFiles = new List<ScratchFile>();
			Projects = new List<ProjectFacade>();
			Solution = null;
			Log = new List<LogEntry>();
			HasConfig = false;
			Flags = new Flags();
			
	}
开发者ID:MiniverCheevy,项目名称:Spawn,代码行数:10,代码来源:VisualStudioHelper.cs

示例13: SetFlag

 public void SetFlag(Flags mask, bool value)
 {
     if (value)
     {
         this.flags |= mask;
     }
     else
     {
         this.flags &= ~mask;
     }
 }
开发者ID:Lessica,项目名称:Something-of-SHIPWAR-GAMES,代码行数:11,代码来源:tk2dBatchedSprite.cs

示例14: Read_CWav

 private static byte[] Read_CWav(Stream stream, Flags flags)
 {
     if (flags.SoundEffect)
     {
         using (var br = new BinaryReader(stream, Encoding.ASCII, true))
         {
             stream.Position = 0xBC;
             var len = br.ReadUInt32();
             var offset = br.ReadUInt32();
             stream.Position = offset;
             return br.ReadBytes((int) len);
         }
     }
     return new byte[0];
 }
开发者ID:usagirei,项目名称:3DS-Theme-Editor,代码行数:15,代码来源:Theme.cs

示例15: Test

        public static void Test()
        {
            int result;
            //3
            result = new Flags().solution(new int[] { 1, 5, 3, 4, 3, 4, 1, 2, 3, 4, 6, 2 });

            //2
            result = new Flags().solution(new int[] { 0, 1, 0, 1, 0, 1, 0 });

            //2
            result = new Flags().solution(new int[] { 0, 1, 0, 0, 1, 0, 1, 0 });

            //3
            result = new Flags().solution(new int[] { 0, 1, 0, 0, 1, 0, 1, 0, 1, 0 });
        }
开发者ID:jrkosinski,项目名称:Codility,代码行数:15,代码来源:Flags.cs


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