本文整理汇总了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;
}
示例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;
}
示例3: SetFlag
public void SetFlag(Flags flag, bool b)
{
if (b)
StatusRegister |= (byte)flag;
else
StatusRegister &= (byte)~flag;
}
示例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();
}
示例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();
}
示例6: Awake
void Awake()
{
GameObject c = GameObject.FindGameObjectWithTag ("GameController");
flags = c.GetComponent<Flags>();
transition = GameObject.FindGameObjectWithTag("Fader").GetComponent<SceneTransition>();
flags.AddCutsceneFlag(cutsceneDialogue.name);
}
示例7: Resolve_Nosynonyms_ArgumentNotFound_ReturnsNull
public void Resolve_Nosynonyms_ArgumentNotFound_ReturnsNull()
{
var flags = new Flags();
var result = flags.Resolve("argument");
Assert.IsNull(result);
}
示例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"));
}
示例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"));
}
示例10: InitializeResolver
public static void InitializeResolver(Flags f)
{
UrlResolver.HrefResolver =
new Lazy<IPathResolver>(
() =>
new ContentResolver
{
ContentDir = f.WebAppRoot
});
}
示例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;
}
示例12: VisualStudioHelper
internal VisualStudioHelper()
{
ScratchFiles = new List<ScratchFile>();
Projects = new List<ProjectFacade>();
Solution = null;
Log = new List<LogEntry>();
HasConfig = false;
Flags = new Flags();
}
示例13: SetFlag
public void SetFlag(Flags mask, bool value)
{
if (value)
{
this.flags |= mask;
}
else
{
this.flags &= ~mask;
}
}
示例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];
}
示例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 });
}