當前位置: 首頁>>代碼示例>>C#>>正文


C# BaseContext類代碼示例

本文整理匯總了C#中BaseContext的典型用法代碼示例。如果您正苦於以下問題:C# BaseContext類的具體用法?C# BaseContext怎麽用?C# BaseContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BaseContext類屬於命名空間,在下文中一共展示了BaseContext類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddNewComputerSteps

 public AddNewComputerSteps(BaseContext baseContext)
     : base(baseContext)
 {
     client = new RestClient("http://computer-database.herokuapp.com/");
     request = new RestRequest("computers", Method.POST);
     newComputer = new NewComputer();
 }
開發者ID:oflorko,項目名稱:BackBaseTask,代碼行數:7,代碼來源:AddNewComputerSteps.cs

示例2: Execute

 public override void Execute(Context _context)
 {
     // action logic here
     //if( context.target == null) return;
     context = (BaseContext) _context;
     context.alive = false;
     // Debug.Log("Destroy" + context.gameObject.name);
     // context.StartCoroutine(WaitAndDestroy() );
     GameObject.Destroy(context.gameObject);
 }
開發者ID:saygt,項目名稱:samuraivillage,代碼行數:10,代碼來源:Do_Destroy.cs

示例3: GetRoleCodeList

        /// <summary>
        /// 根據用戶編碼取角色集合
        /// </summary>
        /// <param name="userCode">用戶編碼</param>
        /// <returns></returns>
        private static List<string> GetRoleCodeList(string userCode)
        {
            List<string> list = new List<string>();
            using (var context = new BaseContext())
            {
                if (!string.IsNullOrEmpty(userCode))
                {
                    var user = context.Users.FirstOrDefault(u => u.Code == userCode);
                    if (user != null)
                    {
                        var roleCodes = (from ru in context.RoleUsers
                                         join r in context.Roles on ru.RoleID equals r.ID
                                         where ru.UserID == user.ID
                                         select r.Code
                          ).ToList();
                        list = roleCodes;
                    }

                }
            }
            return list;
        }
開發者ID:wangchunlei,項目名稱:MyGit,代碼行數:27,代碼來源:AuthManager.cs

示例4: Execute

    public override void Execute(Context _context)
    {
        // action logic here
        //if( context.target == null) return;
        context = (BaseContext) _context;
        context.alive = false;
        // Debug.Log("Destroy" + context.gameObject.name);
        // context.StartCoroutine(WaitAndDestroy() );
        if(context.lastHit != null){
            pc = context.lastHit.GetComponent<PlayerContext>();
            player = GameObject.FindObjectOfType(typeof(PlayerContext)) as PlayerContext;
        }

        if(context.team == 1 && pc == null)
        {
            // player.streak = 0;
        }
        else if(context.team == 1 && pc != null){
            player.streak += 1;
            DisplayBounty();
        }
        GameObject.Destroy(context.gameObject);
    }
開發者ID:saygt,項目名稱:samuraivillage,代碼行數:23,代碼來源:Do_Die.cs

示例5: DoResolveTypeParameters

		protected virtual bool DoResolveTypeParameters ()
		{
			var tparams = CurrentTypeParameters;
			if (tparams == null)
				return true;

			var base_context = new BaseContext (this);
			for (int i = 0; i < tparams.Count; ++i) {
				var tp = tparams[i];

				if (!tp.ResolveConstraints (base_context)) {
					error = true;
					return false;
				}
			}

			if (IsPartialPart) {
				PartialContainer.CurrentTypeParameters.UpdateConstraints (this);
			}

			return true;
		}
開發者ID:fvalette,項目名稱:mono,代碼行數:22,代碼來源:class.cs

示例6: ResolveBaseTypes

		/// <summary>
		///   This function computes the Base class and also the
		///   list of interfaces that the class or struct @c implements.
		///   
		///   The return value is an array (might be null) of
		///   interfaces implemented (as Types).
		///   
		///   The @base_class argument is set to the base object or null
		///   if this is `System.Object'. 
		/// </summary>
		protected virtual TypeSpec[] ResolveBaseTypes (out FullNamedExpression base_class)
		{
			base_class = null;
			if (type_bases == null)
				return null;

			int count = type_bases.Count;
			TypeSpec[] ifaces = null;
			var base_context = new BaseContext (this);
			for (int i = 0, j = 0; i < count; i++){
				FullNamedExpression fne = type_bases [i];

				var fne_resolved = fne.ResolveAsType (base_context);
				if (fne_resolved == null)
					continue;

				if (i == 0 && Kind == MemberKind.Class && !fne_resolved.IsInterface) {
					if (fne_resolved.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
						Report.Error (1965, Location, "Class `{0}' cannot derive from the dynamic type",
							GetSignatureForError ());

						continue;
					}
					
					base_type = fne_resolved;
					base_class = fne;
					continue;
				}

				if (ifaces == null)
					ifaces = new TypeSpec [count - i];

				if (fne_resolved.IsInterface) {
					for (int ii = 0; ii < j; ++ii) {
						if (fne_resolved == ifaces [ii]) {
							Report.Error (528, Location, "`{0}' is already listed in interface list",
								fne_resolved.GetSignatureForError ());
							break;
						}
					}

					if (Kind == MemberKind.Interface && !IsAccessibleAs (fne_resolved)) {
						Report.Error (61, fne.Location,
							"Inconsistent accessibility: base interface `{0}' is less accessible than interface `{1}'",
							fne_resolved.GetSignatureForError (), GetSignatureForError ());
					}
				} else {
					Report.SymbolRelatedToPreviousError (fne_resolved);
					if (Kind != MemberKind.Class) {
						Report.Error (527, fne.Location, "Type `{0}' in interface list is not an interface", fne_resolved.GetSignatureForError ());
					} else if (base_class != null)
						Report.Error (1721, fne.Location, "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')",
							GetSignatureForError (), base_class.GetSignatureForError (), fne_resolved.GetSignatureForError ());
					else {
						Report.Error (1722, fne.Location, "`{0}': Base class `{1}' must be specified as first",
							GetSignatureForError (), fne_resolved.GetSignatureForError ());
					}
				}

				ifaces [j++] = fne_resolved;
			}

			return ifaces;
		}
開發者ID:fvalette,項目名稱:mono,代碼行數:74,代碼來源:class.cs

示例7: DoResolveTypeParameters

		protected virtual bool DoResolveTypeParameters ()
		{
			var tparams = MemberName.TypeParameters;
			if (tparams == null)
				return true;

			var base_context = new BaseContext (this);
			for (int i = 0; i < tparams.Count; ++i) {
				var tp = tparams[i];

				if (!tp.ResolveConstraints (base_context)) {
					error = true;
					return false;
				}

				if (IsPartialPart) {
					var pc_tp = PartialContainer.CurrentTypeParameters [i];

					tp.Create (spec, this);
					tp.Define (pc_tp);

					if (tp.OptAttributes != null) {
						if (pc_tp.OptAttributes == null)
							pc_tp.OptAttributes = tp.OptAttributes;
						else
							pc_tp.OptAttributes.Attrs.AddRange (tp.OptAttributes.Attrs);
					}
				}
			}

			if (IsPartialPart) {
				PartialContainer.CurrentTypeParameters.UpdateConstraints (this);
			}

			return true;
		}
開發者ID:0xd4d,項目名稱:NRefactory,代碼行數:36,代碼來源:class.cs

示例8: DoResolveTypeParameters

		protected virtual bool DoResolveTypeParameters ()
		{
			if (CurrentTypeParameters == null)
				return true;

			if (PartialContainer != this)
				throw new InternalErrorException ();

			var base_context = new BaseContext (this);
			foreach (TypeParameter type_param in CurrentTypeParameters) {
				if (!type_param.ResolveConstraints (base_context)) {
					error = true;
					return false;
				}
			}

			if (partial_parts != null) {
				foreach (TypeContainer part in partial_parts)
					UpdateTypeParameterConstraints (part);
			}

			return true;
		}
開發者ID:jordanbtucker,項目名稱:mono,代碼行數:23,代碼來源:class.cs

示例9: DoResolveTypeParameters

		protected virtual bool DoResolveTypeParameters ()
		{
			var tparams = CurrentTypeParameters;
			if (tparams == null)
				return true;

			if (PartialContainer != this)
				throw new InternalErrorException ();

			var base_context = new BaseContext (this);
			for (int i = 0; i < tparams.Count; ++i) {
				var tp = tparams[i];

				if (!tp.ResolveConstraints (base_context)) {
					error = true;
					return false;
				}
			}

			if (partial_parts != null) {
				foreach (TypeContainer part in partial_parts)
					UpdateTypeParameterConstraints (part);
			}

			return true;
		}
開發者ID:agallero,項目名稱:mono,代碼行數:26,代碼來源:class.cs

示例10: ResolveBaseTypes

		/// <summary>
		///   This function computes the Base class and also the
		///   list of interfaces that the class or struct @c implements.
		///   
		///   The return value is an array (might be null) of
		///   interfaces implemented (as Types).
		///   
		///   The @base_class argument is set to the base object or null
		///   if this is `System.Object'. 
		/// </summary>
		protected virtual TypeExpr[] ResolveBaseTypes (out TypeExpr base_class)
		{
			base_class = null;
			if (type_bases == null)
				return null;

			int count = type_bases.Count;
			TypeExpr [] ifaces = null;
			IMemberContext base_context = new BaseContext (this);
			for (int i = 0, j = 0; i < count; i++){
				FullNamedExpression fne = (FullNamedExpression) type_bases [i];

				//
				// Standard ResolveAsTypeTerminal cannot be used in this case because
				// it does ObsoleteAttribute and constraint checks which require
				// base type to be set
				//
				TypeExpr fne_resolved = fne.ResolveAsBaseTerminal (base_context, false);
				if (fne_resolved == null)
					continue;

				if (i == 0 && Kind == Kind.Class && !fne_resolved.Type.IsInterface) {
					if (fne_resolved is DynamicTypeExpr)
						Report.Error (1965, Location, "Class `{0}' cannot derive from the dynamic type",
							GetSignatureForError ());
					else
						base_class = fne_resolved;
					continue;
				}

				if (ifaces == null)
					ifaces = new TypeExpr [count - i];

				if (fne_resolved.Type.IsInterface) {
					for (int ii = 0; ii < j; ++ii) {
						if (TypeManager.IsEqual (fne_resolved.Type, ifaces [ii].Type)) {
							Report.Error (528, Location, "`{0}' is already listed in interface list",
								fne_resolved.GetSignatureForError ());
							break;
						}
					}

					if (Kind == Kind.Interface && !IsAccessibleAs (fne_resolved.Type)) {
						Report.Error (61, fne.Location,
							"Inconsistent accessibility: base interface `{0}' is less accessible than interface `{1}'",
							fne_resolved.GetSignatureForError (), GetSignatureForError ());
					}
				} else {
					Report.SymbolRelatedToPreviousError (fne_resolved.Type);
					if (Kind != Kind.Class) {
						Report.Error (527, fne.Location, "Type `{0}' in interface list is not an interface", fne_resolved.GetSignatureForError ());
					} else if (base_class != null)
						Report.Error (1721, fne.Location, "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')",
							GetSignatureForError (), base_class.GetSignatureForError (), fne_resolved.GetSignatureForError ());
					else {
						Report.Error (1722, fne.Location, "`{0}': Base class `{1}' must be specified as first",
							GetSignatureForError (), fne_resolved.GetSignatureForError ());
					}
				}

				ifaces [j++] = fne_resolved;
			}

			return ifaces;
		}
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:75,代碼來源:class.cs


注:本文中的BaseContext類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。