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


C# Guid类代码示例

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


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

示例1: UpdateInfoDC

 public UpdateInfoDC(Guid registrationId, Guid client, string meshId, PeerNodeAddress address)
 {
     this.ClientId = client;
     this.MeshId = meshId;
     this.NodeAddress = address;
     this.RegistrationId = registrationId;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:UpdateInfo.cs

示例2: LogHttpResponse

 public static void LogHttpResponse(this DiagnosticListener @this, HttpResponseMessage response, Guid loggingRequestId)
 {
     if (@this.IsEnabled(HttpHandlerLoggingStrings.ResponseWriteName))
     {
         LogHttpResponseCore(@this, response, loggingRequestId);
     }
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:7,代码来源:HttpHandlerDiagnosticListenerExtensions.cs

示例3: SetCurrentThreadActivityId

        // ActivityID support (see also WriteEventWithRelatedActivityIdCore)
        /// <summary>
        /// When a thread starts work that is on behalf of 'something else' (typically another 
        /// thread or network request) it should mark the thread as working on that other work.
        /// This API marks the current thread as working on activity 'activityID'. This API
        /// should be used when the caller knows the thread's current activity (the one being
        /// overwritten) has completed. Otherwise, callers should prefer the overload that
        /// return the oldActivityThatWillContinue (below).
        /// 
        /// All events created with the EventSource on this thread are also tagged with the 
        /// activity ID of the thread. 
        /// 
        /// It is common, and good practice after setting the thread to an activity to log an event
        /// with a 'start' opcode to indicate that precise time/thread where the new activity 
        /// started.
        /// </summary>
        /// <param name="activityId">A Guid that represents the new activity with which to mark 
        /// the current thread</param>
        public static void SetCurrentThreadActivityId(Guid activityId)
        {
            if (TplEtwProvider.Log != null)
                TplEtwProvider.Log.SetActivityId(activityId);
#if FEATURE_MANAGED_ETW
#if FEATURE_ACTIVITYSAMPLING
            Guid newId = activityId;
#endif // FEATURE_ACTIVITYSAMPLING
            // We ignore errors to keep with the convention that EventSources do not throw errors.
            // Note we can't access m_throwOnWrites because this is a static method.  

            if (UnsafeNativeMethods.ManifestEtw.EventActivityIdControl(
                UnsafeNativeMethods.ManifestEtw.ActivityControl.EVENT_ACTIVITY_CTRL_GET_SET_ID,
                ref activityId) == 0)
            {
#if FEATURE_ACTIVITYSAMPLING
                var activityDying = s_activityDying;
                if (activityDying != null && newId != activityId)
                {
                    if (activityId == Guid.Empty)
                    {
                        activityId = FallbackActivityId;
                    }
                    // OutputDebugString(string.Format("Activity dying: {0} -> {1}", activityId, newId));
                    activityDying(activityId);     // This is actually the OLD activity ID.  
                }
#endif // FEATURE_ACTIVITYSAMPLING
            }
#endif // FEATURE_MANAGED_ETW
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:48,代码来源:EventSource_CoreCLR.cs

示例4: AsyncResult

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ownerId">
 /// Instance Id of the object creating this instance
 /// </param>
 /// <param name="callback">
 /// A AsyncCallback to call once the async operation completes.
 /// </param>
 /// <param name="state">
 /// A user supplied state object
 /// </param>
 internal AsyncResult(Guid ownerId, AsyncCallback callback, object state)
 {
     Dbg.Assert(Guid.Empty != ownerId, "ownerId cannot be empty");
     OwnerId = ownerId;
     Callback = callback;
     AsyncState = state;
 }
开发者ID:40a,项目名称:PowerShell,代码行数:19,代码来源:AsyncResult.cs

示例5: Register_ActivateAccount

 public static void Register_ActivateAccount(Guid UserNameValidActivationToken)
 {
     ControllerFake<UserAccountController, object> controller = new ControllerFake<UserAccountController, object>();
     ActionResult resultValid = controller.Controller.Activate(UserNameValidActivationToken.ToString());
     Assert.AreEqual(true, resultValid.GetType() == typeof(RedirectResult));
     Assert.AreEqual(true, (((RedirectResult)resultValid).Url == controller.Controller.RedirectResultOnLogIn().Url));
 }
开发者ID:jordivila,项目名称:Net_MVC_NLayer_Generator,代码行数:7,代码来源:MembershipCommonTestMethods.cs

示例6: ReadChangeSetRequestAsync

        public static async Task<IList<HttpRequestMessage>> ReadChangeSetRequestAsync(this ODataBatchReader reader, Guid batchId, CancellationToken cancellationToken)
        {
            if (reader == null)
            {
                throw Error.ArgumentNull("reader");
            }
            if (reader.State != ODataBatchReaderState.ChangesetStart)
            {
                throw Error.InvalidOperation(
                    SRResources.InvalidBatchReaderState,
                    reader.State.ToString(),
                    ODataBatchReaderState.ChangesetStart.ToString());
            }

            Guid changeSetId = Guid.NewGuid();
            List<HttpRequestMessage> requests = new List<HttpRequestMessage>();
            while (reader.Read() && reader.State != ODataBatchReaderState.ChangesetEnd)
            {
                if (reader.State == ODataBatchReaderState.Operation)
                {
                    requests.Add(await ReadOperationInternalAsync(reader, batchId, changeSetId, cancellationToken));
                }
            }
            return requests;
        }
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:25,代码来源:ODataBatchReaderExtensions.cs

示例7: Schedule

		protected internal override void Schedule (WaitCallback callback, Guid workflowInstanceId, DateTime whenUtc, Guid timerId)
		{
			//WorkflowInstance wi = WorkflowRuntime.GetInstanceFromGuid (workflowInstanceId);

			//wi.TimerEventSubscriptionCollection.Add
			//	(new TimerEventSubscription (workflowInstanceId, timerId));
		}
开发者ID:alesliehughes,项目名称:olive,代码行数:7,代码来源:DefaultWorkflowSchedulerService.cs

示例8: SymDocumentWriter

	public virtual ISymbolDocumentWriter DefineDocument
				(String url, Guid language, Guid languageVendor,
				 Guid documentType)
			{
				// Nothing to do here.
				return new SymDocumentWriter();
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:SymWriter.cs

示例9:

        protected void GenerateLoadSqlCommand
            (
            SqlCommand command, 
            LoadType loadType, 
            Guid keyToLoadBy, 
            Guid instanceId, 
            List<CorrelationKey> keysToAssociate
            )
        {
            long surrogateLockOwnerId = base.StoreLock.SurrogateLockOwnerId;
            byte[] concatenatedKeyProperties = null;
            bool singleKeyToAssociate = (keysToAssociate != null && keysToAssociate.Count == 1);

            if (keysToAssociate != null)
            {
                concatenatedKeyProperties = SerializationUtilities.CreateKeyBinaryBlob(keysToAssociate);
            }

            double operationTimeout = this.TimeoutHelper.RemainingTime().TotalMilliseconds;

            SqlParameterCollection parameters = command.Parameters;
            parameters.Add(new SqlParameter { ParameterName = "@surrogateLockOwnerId", SqlDbType = SqlDbType.BigInt, Value = surrogateLockOwnerId });
            parameters.Add(new SqlParameter { ParameterName = "@operationType", SqlDbType = SqlDbType.TinyInt, Value = loadType });
            parameters.Add(new SqlParameter { ParameterName = "@keyToLoadBy", SqlDbType = SqlDbType.UniqueIdentifier, Value = keyToLoadBy });
            parameters.Add(new SqlParameter { ParameterName = "@instanceId", SqlDbType = SqlDbType.UniqueIdentifier, Value = instanceId });
            parameters.Add(new SqlParameter { ParameterName = "@handleInstanceVersion", SqlDbType = SqlDbType.BigInt, Value = base.InstancePersistenceContext.InstanceVersion });
            parameters.Add(new SqlParameter { ParameterName = "@handleIsBoundToLock", SqlDbType = SqlDbType.Bit, Value = base.InstancePersistenceContext.InstanceView.IsBoundToLock });
            parameters.Add(new SqlParameter { ParameterName = "@keysToAssociate", SqlDbType = SqlDbType.Xml, Value = singleKeyToAssociate ? DBNull.Value : SerializationUtilities.CreateCorrelationKeyXmlBlob(keysToAssociate) });
            parameters.Add(new SqlParameter { ParameterName = "@encodingOption", SqlDbType = SqlDbType.TinyInt, Value = base.Store.InstanceEncodingOption });
            parameters.Add(new SqlParameter { ParameterName = "@concatenatedKeyProperties", SqlDbType = SqlDbType.VarBinary, Value = (object) concatenatedKeyProperties ?? DBNull.Value });
            parameters.Add(new SqlParameter { ParameterName = "@operationTimeout", SqlDbType = SqlDbType.Int, Value = (operationTimeout < Int32.MaxValue) ? Convert.ToInt32(operationTimeout) : Int32.MaxValue });
            parameters.Add(new SqlParameter { ParameterName = "@singleKeyId", SqlDbType = SqlDbType.UniqueIdentifier, Value = singleKeyToAssociate ? keysToAssociate[0].KeyId : (object) DBNull.Value });
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:33,代码来源:LoadWorkflowAsyncResult.cs

示例10: Vote

        public bool Vote(string serviceID, string clientID, string pollStr, string choiceStr)
        {
            BowmarPollsDataContext context = new BowmarPollsDataContext();

            Guid choice = new Guid(choiceStr);
            Guid poll = new Guid(pollStr);

            if (this.hasClientParticipated(context, poll, clientID))
                return false;

            var query = from element in context.PollElements
                        where element.id == choice
                        select element;

            foreach (PollElement element in query)
            {
                if (element.count == null)
                    element.count = 0;

                element.count++;
            }

                ClientParticipation cp = new ClientParticipation();
                cp.client_id = clientID;
                cp.poll_id = poll;
                context.ClientParticipations.InsertOnSubmit(cp);

            context.SubmitChanges();

            return true;
        }
开发者ID:kilroy68,项目名称:BowmarPolls,代码行数:31,代码来源:BowmarPollService.svc.cs

示例11: CheckRegistered

 private static unsafe bool CheckRegistered(Guid id, Assembly assembly, [MarshalAs(UnmanagedType.U1)] bool checkCache, [MarshalAs(UnmanagedType.U1)] bool cacheOnly)
 {
     if (checkCache && (_regCache[assembly] != null))
     {
         return true;
     }
     if (cacheOnly)
     {
         return false;
     }
     bool flag = false;
     string name = @"CLSID\{" + id.ToString() + @"}\InprocServer32";
     RegistryKey key = Registry.ClassesRoot.OpenSubKey(name, false);
     if (key != null)
     {
         _regCache[assembly] = bool.TrueString;
     }
     else if (IsWin64(&flag))
     {
         HKEY__* hkey__Ptr;
         IntPtr hglobal = Marshal.StringToHGlobalUni(name);
         char* chPtr = (char*) hglobal.ToPointer();
         int num = flag ? 0x100 : 0x200;
         Marshal.FreeHGlobal(hglobal);
         if (RegOpenKeyExW(-2147483648, (char modopt(IsConst)*) chPtr, 0, (uint modopt(IsLong)) (num | 0x20019), &hkey__Ptr) != 0)
         {
             return false;
         }
         RegCloseKey(hkey__Ptr);
         return true;
     }
     return ((key != null) ? ((bool) ((byte) 1)) : ((bool) ((byte) 0)));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:Proxy.cs

示例12: Create

        public void Create()
        {
            // SqlGuid (Byte[])
            byte[] b = new byte[16];
            b[0] = 100;
            b[1] = 200;

            try
            {
                SqlGuid Test = new SqlGuid(b);

                // SqlGuid (Guid)
                Guid TestGuid = new Guid(b);
                Test = new SqlGuid(TestGuid);

                // SqlGuid (string)
                Test = new SqlGuid("12345678-1234-1234-1234-123456789012");

                // SqlGuid (int, short, short, byte, byte, byte, byte, byte, byte, byte, byte)
                Test = new SqlGuid(10, 1, 2, 13, 14, 15, 16, 17, 19, 20, 21);
            }
            catch (Exception e)
            {
                Assert.False(true);
            }
        }
开发者ID:dotnet,项目名称:corefx,代码行数:26,代码来源:SqlGuidTest.cs

示例13: AuditRuleFactory

		public virtual AuditRule AuditRuleFactory (IdentityReference identityReference, int accessMask,
							   bool isInherited, InheritanceFlags inheritanceFlags,
							   PropagationFlags propagationFlags, AuditFlags flags,
							   Guid objectType, Guid inheritedObjectType)
		{
			throw GetNotImplementedException ();
		}
开发者ID:jack-pappas,项目名称:mono,代码行数:7,代码来源:DirectoryObjectSecurity.cs

示例14: Guid

 static Guid()
 {
     // Note: this type is marked as 'beforefieldinit'.
     Guid guid = new Guid(new byte[16]);
     Guid.zeroString = guid.ToString();
     Guid.random = new Random();
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:7,代码来源:Guid.cs

示例15: MembershipUnitTests

 public MembershipUnitTests()
 {
     _userGuid = Guid.NewGuid();
     _userName = _userGuid.ToString();
     _userEmail = string.Format("{0}@gmail.com", _userName.Replace("-", string.Empty));
     _userPwd = "1*dk**_=lsdk/()078909";
 }
开发者ID:jordivila,项目名称:Net_MVC_NLayer_Generator,代码行数:7,代码来源:MembershipProxyTests.cs


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