Passing a unique identifier as a parameter
Hey, I just wanted to know if i have a parameter with a type of 开发者_如何学Gouniqueidentifier, how can i pass that in my code as a parameter:
personId uniqueidentifier
public IQueryable<Report_person>GetPerson(uniqueidentifier personId)
Thanks.
Usually uniqueidentifier
corresponds with System.Guid
, as listed in SqlDbType.
Depends on what your uniqueidentifier is. C# has a Guid
class that is used for globally unique identifiers, or if this is for a database and you have just an incremental ID number as the identifier and int
would be fine. Depends on how you are creating the ID and what you are using it for, but usually a unique Identifier in C# is represented by a Guid
or Globally Unique Identifier
Guid uniqueId = Guid.NewGuid();
public IQueryable<Report_person>GetPerson(Guid personId) {}
精彩评论