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


C# Guid.ToString方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: ResetPassword_Succeed

 public static void ResetPassword_Succeed(string UserEmailValid, Guid CantAccessMyAccountToken, string NewPassword)
 {
     ControllerFake<UserAccountController, ResetPasswordClientModel> controller = new ControllerFake<UserAccountController, ResetPasswordClientModel>();
     ResetPasswordClientModel model = new ResetPasswordClientModel() { NewPassword = NewPassword, ConfirmPassword = NewPassword };
     ActionResult actionResult = controller.Controller.ResetPassword(CantAccessMyAccountToken.ToString(), model);
     Assert.AreEqual(true, actionResult.GetType() == typeof(RedirectResult));
     Assert.AreEqual(true, (((RedirectResult)actionResult).Url == controller.Controller.RedirectResultOnLogIn().Url));
 }
开发者ID:jordivila,项目名称:Net_MVC_NLayer_Generator,代码行数:8,代码来源:MembershipCommonTestMethods.cs

示例6: CreateDataPacket

        internal static string CreateDataPacket(byte[] data, DataPriorityType streamType, Guid psGuid)
        {
            string result = string.Format(CultureInfo.InvariantCulture,
                "<{0} {1}='{2}' {3}='{4}'>{5}</{0}>",
                PS_OUT_OF_PROC_DATA_TAG,
                PS_OUT_OF_PROC_STREAM_ATTRIBUTE,
                streamType.ToString(),
                PS_OUT_OF_PROC_PSGUID_ATTRIBUTE,
                psGuid.ToString(),
                Convert.ToBase64String(data));

            return result;
        }
开发者ID:dfinke,项目名称:powershell,代码行数:13,代码来源:OutOfProcTransportManager.cs

示例7: GetCurrencySymbol

 public static string GetCurrencySymbol(Guid currencyId)
 {
     // Lookup the currency code/symbol
     EntityCollection orgSettings = CachedOrganizationService.RetrieveMultiple(@"<fetch distinct='false' no-lock='false' mapping='logical'><entity name='organization'><attribute name='currencydisplayoption' /><attribute name='currencysymbol' /></entity></fetch>");
     Entity orgSetting = orgSettings.Entities[0];
     Entity currency = CachedOrganizationService.Retrieve("transactioncurrency", currencyId.ToString(), new string[] { "currencysymbol", "isocurrencycode" });
     if (orgSetting.GetAttributeValueInt("currencydisplayoption") == 0)
     {
         // Currency Symbol
         return currency.GetAttributeValueString("currencysymbol") + " ";
     }
     else
     {
         // Currency ISO Code
         return currency.GetAttributeValueString("isocurrencycode") + " ";
     }
 }
开发者ID:KostyaAfendikov,项目名称:SparkleXrm,代码行数:17,代码来源:NumberEx.cs

示例8: UpdateFolder

        /// <summary>
        /// Thread-safe method for updating the contents of the specified folder Guid
        /// </summary>
        /// <param name="folderID"></param>
        public void UpdateFolder(Guid folderID)
        {
            if (this.InvokeRequired) this.BeginInvoke((MethodInvoker)delegate { UpdateFolder(folderID); });
            else
            {
                TreeNode node = null;
                TreeNodeCollection children;

                if (folderID != Client.Inventory.Store.RootFolder.Guid)
                {
                    TreeNode[] found = Nodes.Find(folderID.ToString(), true);
                    if (found.Length > 0)
                    {
                        node = found[0];
                        children = node.Nodes;
                    }
                    else
                    {
                        Logger.Log("Received update for unknown TreeView node " + folderID, Helpers.LogLevel.Warning);
                        return;
                    }
                }
                else children = this.Nodes;

                children.Clear();

                List<InventoryBase> contents = Client.Inventory.Store.GetContents(folderID);
                if (contents.Count == 0)
                {
                    TreeNode add = children.Add(null, "(empty)");
                    add.ForeColor = Color.FromKnownColor(KnownColor.GrayText);
                }
                else
                {
                    foreach (InventoryBase inv in contents)
                    {
                        string key = inv.Guid.ToString();
                        children.Add(key, inv.Name);
                        children[key].Tag = inv;
                        if (inv is InventoryFolder)
                        {
                            children[key].Nodes.Add(null, "(loading...)").ForeColor = Color.FromKnownColor(KnownColor.GrayText);
                        }
                    }
                }
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:51,代码来源:InventoryTree.cs

示例9: QueryService

            // IOleServiceProvider methods

            public int QueryService(ref Guid guidService, ref Guid riid, out IntPtr ppvObject) {
                GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::QueryService(" + guidService.ToString() + ")");
                
                int hr = (int)HRESULT.E_NOINTERFACE;
                ppvObject = IntPtr.Zero;
                
                if (guidService == typeof(IInternetHostSecurityManager).GUID) {
                    IntPtr ppObj = Marshal.GetIUnknownForObject(this);
                    try {
                        hr = Marshal.QueryInterface(ppObj, ref riid, out ppvObject);
                    }
                    finally {
                        Marshal.Release(ppObj);
                    }
                }

                return hr;
            }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:20,代码来源:_autowebproxyscriptwrapper.cs

示例10: WriteMessage

 /// <summary>
 /// 
 /// </summary>
 /// <param name="className"></param>
 /// <param name="methodName"></param>
 /// <param name="workflowId"></param>
 /// <param name="activityName"></param>
 /// <param name="activityId"></param>
 /// <param name="message"></param>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public void WriteMessage(string className, string methodName, Guid workflowId, string activityName, Guid activityId, string message, params string[] parameters)
 {
     PSEtwLog.LogAnalyticVerbose(PSEventId.Engine_Trace,
                                 PSOpcode.Method, PSTask.None,
                                 PSKeyword.UseAlwaysAnalytic,
                                 className, methodName, workflowId.ToString(),
                                 parameters == null ? message : StringUtil.Format(message, parameters),
                                 String.Empty, // Job
                                 activityName,
                                 activityId.ToString(),
                                 String.Empty);
 }
开发者ID:40a,项目名称:PowerShell,代码行数:23,代码来源:PowerShellETWTracer.cs

示例11: BuildBehavior

 public IActionBehavior BuildBehavior(ServiceArguments arguments, Guid behaviorId)
 {
     return _container.GetInstance<IActionBehavior>(arguments.ToExplicitArgs(), behaviorId.ToString());
 }
开发者ID:bbehrens,项目名称:fubumvc,代码行数:4,代码来源:StructureMapContainerFacility.cs

示例12: LogScriptBlockStart

        internal static void LogScriptBlockStart(ScriptBlock scriptBlock, Guid runspaceId)
        {
            // When invoking, log the creation of the script block if it has suspicious
            // content
            bool forceLogCreation = false;
            if (scriptBlock._scriptBlockData.HasSuspiciousContent)
            {
                forceLogCreation = true;
            }

            // We delay logging the creation util the 'Start' so that we can be sure we've
            // properly analyzed the script block's security.
            LogScriptBlockCreation(scriptBlock, forceLogCreation);

            if (ShouldLogScriptBlockActivity("EnableScriptBlockInvocationLogging"))
            {
                PSEtwLog.LogOperationalVerbose(PSEventId.ScriptBlock_Invoke_Start_Detail, PSOpcode.Create, PSTask.CommandStart, PSKeyword.UseAlwaysAnalytic,
                    scriptBlock.Id.ToString(), runspaceId.ToString());
            }
        }
开发者ID:40a,项目名称:PowerShell,代码行数:20,代码来源:CompiledScriptBlock.cs

示例13: CreateNativeIdentifier

 public static string CreateNativeIdentifier(Guid transactionId)
 {
     return UuidScheme + transactionId.ToString("D");
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:4,代码来源:WsatExtendedInformation.cs

示例14: ProcessElement

        /// <summary>
        /// Process an XmlElement. The element name must be one of the following:
        ///         "Data"
        /// </summary>
        /// <param name="xmlReader"></param>
        /// <param name="callbacks"></param>
        /// <exception cref="PSRemotingTransportException">
        /// 1. Expected only two attributes with names "{0}" and "{1}" in "{2}" element.
        /// 2. Not enough data available to process "{0}" element.
        /// 3. Unknown node "{0}" in "{1}" element. Only "{2}" is expected in "{1}" element.
        /// </exception>
        private static void ProcessElement(XmlReader xmlReader, DataProcessingDelegates callbacks)
        {
            Dbg.Assert(null != xmlReader, "xmlReader cannot be null.");
            Dbg.Assert(xmlReader.NodeType == XmlNodeType.Element, "xmlReader's NodeType should be of type Element");

            PowerShellTraceSource tracer = PowerShellTraceSourceFactory.GetTraceSource();

            switch (xmlReader.LocalName)
            {
                case OutOfProcessUtils.PS_OUT_OF_PROC_DATA_TAG:
                    {
                        // A <Data> should have 1 attribute identifying the stream
                        if (xmlReader.AttributeCount != 2)
                        {
                            throw new PSRemotingTransportException(PSRemotingErrorId.IPCWrongAttributeCountForDataElement,
                                RemotingErrorIdStrings.IPCWrongAttributeCountForDataElement,
                                OutOfProcessUtils.PS_OUT_OF_PROC_STREAM_ATTRIBUTE,
                                OutOfProcessUtils.PS_OUT_OF_PROC_PSGUID_ATTRIBUTE,
                                OutOfProcessUtils.PS_OUT_OF_PROC_DATA_TAG);
                        }
                        string stream = xmlReader.GetAttribute(OutOfProcessUtils.PS_OUT_OF_PROC_STREAM_ATTRIBUTE);
                        string psGuidString = xmlReader.GetAttribute(OutOfProcessUtils.PS_OUT_OF_PROC_PSGUID_ATTRIBUTE);
                        Guid psGuid = new Guid(psGuidString);

                        // Now move the reader to the data portion
                        if (!xmlReader.Read())
                        {
                            throw new PSRemotingTransportException(PSRemotingErrorId.IPCInsufficientDataforElement,
                                RemotingErrorIdStrings.IPCInsufficientDataforElement,
                                OutOfProcessUtils.PS_OUT_OF_PROC_DATA_TAG);
                        }

                        if (xmlReader.NodeType != XmlNodeType.Text)
                        {
                            throw new PSRemotingTransportException(PSRemotingErrorId.IPCOnlyTextExpectedInDataElement,
                                RemotingErrorIdStrings.IPCOnlyTextExpectedInDataElement,
                                xmlReader.NodeType, OutOfProcessUtils.PS_OUT_OF_PROC_DATA_TAG, XmlNodeType.Text);
                        }

                        string data = xmlReader.Value;
                        tracer.WriteMessage("OutOfProcessUtils.ProcessElement : PS_OUT_OF_PROC_DATA received, psGuid : " + psGuid.ToString());
                        byte[] rawData = Convert.FromBase64String(data);
                        callbacks.DataPacketReceived(rawData, stream, psGuid);
                    }

                    break;
                case OutOfProcessUtils.PS_OUT_OF_PROC_DATA_ACK_TAG:
                    {
                        if (xmlReader.AttributeCount != 1)
                        {
                            throw new PSRemotingTransportException(PSRemotingErrorId.IPCWrongAttributeCountForElement,
                                RemotingErrorIdStrings.IPCWrongAttributeCountForElement,
                                OutOfProcessUtils.PS_OUT_OF_PROC_PSGUID_ATTRIBUTE,
                                OutOfProcessUtils.PS_OUT_OF_PROC_DATA_ACK_TAG);
                        }
                        string psGuidString = xmlReader.GetAttribute(OutOfProcessUtils.PS_OUT_OF_PROC_PSGUID_ATTRIBUTE);
                        Guid psGuid = new Guid(psGuidString);

                        tracer.WriteMessage("OutOfProcessUtils.ProcessElement : PS_OUT_OF_PROC_DATA_ACK received, psGuid : " + psGuid.ToString());
                        callbacks.DataAckPacketReceived(psGuid);
                    }
                    break;
                case OutOfProcessUtils.PS_OUT_OF_PROC_COMMAND_TAG:
                    {
                        if (xmlReader.AttributeCount != 1)
                        {
                            throw new PSRemotingTransportException(PSRemotingErrorId.IPCWrongAttributeCountForElement,
                                RemotingErrorIdStrings.IPCWrongAttributeCountForElement,
                                OutOfProcessUtils.PS_OUT_OF_PROC_PSGUID_ATTRIBUTE,
                                OutOfProcessUtils.PS_OUT_OF_PROC_COMMAND_TAG);
                        }
                        string psGuidString = xmlReader.GetAttribute(OutOfProcessUtils.PS_OUT_OF_PROC_PSGUID_ATTRIBUTE);
                        Guid psGuid = new Guid(psGuidString);

                        tracer.WriteMessage("OutOfProcessUtils.ProcessElement : PS_OUT_OF_PROC_COMMAND received, psGuid : " + psGuid.ToString());
                        callbacks.CommandCreationPacketReceived(psGuid);
                    }
                    break;
                case OutOfProcessUtils.PS_OUT_OF_PROC_COMMAND_ACK_TAG:
                    {
                        if (xmlReader.AttributeCount != 1)
                        {
                            throw new PSRemotingTransportException(PSRemotingErrorId.IPCWrongAttributeCountForElement,
                                RemotingErrorIdStrings.IPCWrongAttributeCountForElement,
                                OutOfProcessUtils.PS_OUT_OF_PROC_PSGUID_ATTRIBUTE,
                                OutOfProcessUtils.PS_OUT_OF_PROC_COMMAND_ACK_TAG);
                        }
                        string psGuidString = xmlReader.GetAttribute(OutOfProcessUtils.PS_OUT_OF_PROC_PSGUID_ATTRIBUTE);
                        Guid psGuid = new Guid(psGuidString);
//.........这里部分代码省略.........
开发者ID:dfinke,项目名称:powershell,代码行数:101,代码来源:OutOfProcTransportManager.cs

示例15: WriteGuidText

 public override void WriteGuidText(Guid value)
 {
     WriteText(value.ToString());
 }
开发者ID:rendle-labs,项目名称:corefx,代码行数:4,代码来源:XmlUTF8TextWriter.cs


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