• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Guid类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ServerRemoteHost

        /// <summary>
        /// Constructor for ServerRemoteHost.
        /// </summary>
        internal ServerRemoteHost(
            Guid clientRunspacePoolId,
            Guid clientPowerShellId,
            HostInfo hostInfo,
            AbstractServerTransportManager transportManager,
            Runspace runspace,
            ServerDriverRemoteHost serverDriverRemoteHost)
        {
            _clientRunspacePoolId = clientRunspacePoolId;
            _clientPowerShellId = clientPowerShellId;
            Dbg.Assert(hostInfo != null, "Expected hostInfo != null");
            Dbg.Assert(transportManager != null, "Expected transportManager != null");

            // Set host-info and the transport-manager.
            HostInfo = hostInfo;
            _transportManager = transportManager;
            _serverDriverRemoteHost = serverDriverRemoteHost;

            // Create the executor for the host methods.
            _serverMethodExecutor = new ServerMethodExecutor(
                clientRunspacePoolId, clientPowerShellId, _transportManager);

            // Use HostInfo to create host-UI as null or non-null based on the client's host-UI.
            _remoteHostUserInterface = hostInfo.IsHostUINull ? null : new ServerRemoteHostUserInterface(this);

            Runspace = runspace;
        }
开发者ID:40a,项目名称:PowerShell,代码行数:30,代码来源:ServerRemoteHost.cs


示例17: InstanceKey

        public InstanceKey(Guid value, IDictionary<XName, InstanceValue> metadata)
        {
            if (value == Guid.Empty)
            {
                throw Fx.Exception.Argument("value", SRCore.InstanceKeyRequiresValidGuid);
            }

            this.Value = value;
            if (metadata != null)
            {
                if (metadata.IsReadOnly)
                {
                    this.Metadata = metadata;
                }
                else
                {
                    Dictionary<XName, InstanceValue> copy = new Dictionary<XName, InstanceValue>(metadata);
                    this.Metadata = new ReadOnlyDictionaryInternal<XName, InstanceValue>(copy);
                }

            }
            else
            {
                this.Metadata = emptyMetadata;
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:26,代码来源:InstanceKey.cs


示例18: PrepareData

        internal void PrepareData()
        {
            lock (_syncObject)
            {
                if (_dataReady == true) return;

                IEnumerable<EventTask> result = _pmReference.Tasks;

                _name = null;
                _displayName = null;
                _guid = Guid.Empty;
                _dataReady = true;

                foreach (EventTask task in result)
                {
                    if (task.Value == _value)
                    {
                        _name = task.Name;
                        _displayName = task.DisplayName;
                        _guid = task.EventGuid;
                        _dataReady = true;
                        break;
                    }
                }
            }
        }
开发者ID:dfinke,项目名称:powershell,代码行数:26,代码来源:EventTask.cs


示例19: SymbolDocumentWithGuids

 internal SymbolDocumentWithGuids(string fileName, ref Guid language, ref Guid vendor, ref Guid documentType)
     : base(fileName)
 {
     Language = language;
     LanguageVendor = vendor;
     DocumentType = documentType;
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:SymbolDocumentInfo.cs


示例20: ExecuteOperationAsync

        /// <summary>
        /// Executes the operation.
        /// </summary>
        /// <param name="batchReader">The batch reader.</param>
        /// <param name="batchId">The batch id.</param>
        /// <param name="originalRequest">The original request containing all the batch requests.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>The response for the operation.</returns>
        public virtual async Task<ODataBatchResponseItem> ExecuteOperationAsync(ODataBatchReader batchReader, Guid batchId, HttpRequestMessage originalRequest, CancellationToken cancellationToken)
        {
            if (batchReader == null)
            {
                throw Error.ArgumentNull("batchReader");
            }
            if (originalRequest == null)
            {
                throw Error.ArgumentNull("originalRequest");
            }

            cancellationToken.ThrowIfCancellationRequested();

            OperationRequestItem operation = new OperationRequestItem(await batchReader.ReadOperationRequestAsync(batchId, bufferContentStream: false));
            try
            {
                ODataBatchResponseItem response = await operation.SendRequestAsync(Invoker, cancellationToken);
                return response;
            }
            finally
            {
                originalRequest.RegisterForDispose(operation.GetResourcesForDisposal());
                originalRequest.RegisterForDispose(operation);
            }
        }
开发者ID:balajivasudevan,项目名称:aspnetwebstack,代码行数:33,代码来源:UnbufferedODataBatchHandler.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# GuidId类代码示例发布时间:2022-05-24
下一篇:
C# GuiWidget类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap